Powershell window preventing shutdown

Posted by FrinkTheBrave on Server Fault See other posts from Server Fault or by FrinkTheBrave
Published on 2012-04-16T11:26:30Z Indexed on 2012/04/16 11:32 UTC
Read the original article Hit count: 159

If I have a PowerShell window (at the PS command prompt) on display it prevents the computer shutting down.

i.e. if I open a powershell window and then try to shutdown the server, I get the End Program popup saying Windows cannot end this program

I get the same result if I start the powershell from the start menu, from a cmd prompt and from a shortcut with -NoExit specified.

Any ideas how I can get shutdown to automatically close a powershell window (if it is at the PS prompt) in the same way as it would for a CMD window?

Alternatively, is it possible for PowerShell to detect when a shutdown has been initiated and therefore close itself?

© Server Fault or respective owner

Related posts about windows-server-2003

Related posts about powershell