Depending on your Windows PC energy settings, your machine may go into standby or hibernate after some time even though you might be still running a lengthy script.

One way to ensure that Windows keeps running while your script is busy is to use the “presentation mode”. There is a tool you can use to enable and disable it. In PowerShell, run this:

 
PS> presentationsettings
 

This opens a window where you can check and control your current presentation settings. To automatically start and stop presentation mode, the command supports the parameters /start and /stop.

To ensure that Windows won’t hibernate while your script runs, place this in your first script line:

 
PS> presentationsettings /start  
 

At the end of your script, turn off presentation mode like this:

 
PS> presentationsettings /stop 
 

To verify the effect of both commands, run the command without parameter and check the top-most checkbox in the dialog.



Twitter This Tip! ReTweet this Tip!

Anonymous