Weekend Scripter: The Case of the Disappearing PowerShell Console

The Scripting Guys

Dr Scripto

Summary: Ed Wilson, Microsoft Scripting Guy, talks about fixing a problem where his Windows PowerShell console disappears.

Microsoft Scripting Guy, Ed Wilson, is here. So there I was, on a two week trip, out of time, with only my laptop, and I needed to use Windows PowerShell. Most of the time, I use the Windows PowerShell console, but I do occasionally use the Windows PowerShell ISE. At home, I have a nice-sized second monitor that is attached to my laptop—but I do not—actually the truth is, I rarely travel with my second monitor. I have been known to take it with me on a road trip.

So I click to open the Windows PowerShell console and…nothing. Hmm, I try it again. This time I noticed that the Windows PowerShell console had in fact opened—it was just missing. As shown here, I noticed a white underline beneath the Windows PowerShell console icon I have on my tool bar in Windows 10.

Image of tool bar

I pressed CTRL + Shift + Esc to bring up Task Manager. I saw that Windows PowerShell was in fact running, but I could not see it:

Image of menu

I ended my Windows PowerShell session, closed the Task Manager, and tried again. I confirmed that Windows PowerShell was loading, but it was not visible. Bummer.

Finding a visible Windows PowerShell console

Then I had an idea…

I can use the Windows PowerShell ISE, but I still wanted the Windows PowerShell console. Guess what? There is an icon for the Windows PowerShell console in the tool bar of the Windows PowerShell ISE. I clicked that, and it worked. The icon is shown here:

Image of menu

And that is what I did for two weeks. I clicked the little Windows PowerShell icon on the Windows PowerShell ISE tool bar, and then I had an instance of the Windows PowerShell console I could use. It was not too bad because I often have both the ISE and the console open anyway, but I used to always open the console first—so this was a learning opportunity.

One day, I searched through the registry hoping I could find something that was storing the screen location (usually in pixels in the x and y coordinates). I was hoping to see how it’s opening window position was set, but alas, I did not find it. It might be there, but I could not find it in the 15 minutes I devoted to the task.

Fixing the problem

Eventually I decided to email our internal Windows PowerShell discussion group to see if anyone else had experienced this problem, and if anyone had come up with a solution. After I sent the email, I quickly saw several people replying with +1, which in Microsoft email speak means that they are also having the same problem. Within 15 minutes, someone from our support group replied that I should look at the properties of my Windows PowerShell console window. Remember, that I can get to one via the Windows PowerShell ISE icon.

To find the Windows PowerShell console properties, I click the Windows PowerShell icon in the upper left corner of the Windows PowerShell console window, and then I select Properties from the action menu:

Image of menu

I select the Let System position Window check box on the Layout tab:

Image of menu

He also told me something else that I didn’t know: If the Windows PowerShell console opens off screen, I can click the Windows PowerShell icon on the tool bar to get focus. Then I can press Alt + Spacebar to open the context menu, and press M to enable me to move the Windows PowerShell console via the arrow keys. Cool.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

The Scripting Guys
Dr Scripto

Follow Dr Scripto   

No Comments.