Another script that can be used to make managing a bigger amount of workstations easier.
Ever got annoyed by devices being installed remotely (or manually) by either yourself or software and it keeps going to hibernate? Or perhaps those few HP Surfaces that keep losing their internet connection because someone closes the lid and it goes into sleep-mode?
Not anymore, at least if you manage to execute the script before the device falls asleep.
This script uses the powerconfig command that is included in Windows to make changes to the power settings. That is all it does, it simply adds a different code into the powercfg, which then by Windows is changed into settings it will adjust.
There are multiple variables you can fill in:
This variable is basically able to change the power settings templates that are available. Setting this to Current makes it so that nothing is changed, other options are Highperformance, Powersaver and Balanced which are representing the names of the similar templates you can choose from when setting this up on a device manually.
Above variable determine the amount of minutes it takes before a device shuts down the screen (MonitorTimeout), goes into sleep mode (SleepTimeout) or hibernate mode (HibernateTimeout). Also, it has separated options for either on battery (when on a laptop/Surface/tablet) or connected to cable.
This changes whether a device will go to sleep mode when its lid is closed (laptops/Surfaces etc.).
Setting this to 0 will change nothing, to 1 will keep it active regardless of battery/cable, 2 will keep it active only when on battery and 3 will keep it active only when attached by cable.
This script allows us to quickly deploy devices to clients with the desired power settings (for example able to attach a laptop to external monitors and then shut the lid without losing image on the external monitors)
This script has been tested/used on Windows 10 release up to 1903. I can not make promises for future Windows releases nor usage on Windows 7/8.
Hoping this will have some use and save some time.
Categories: Powershell, Script, Power Settings, Windows
Patrick Berger AKA Powershellder.
[ i ] Parallax section below. Click on the section below to upload image. Don't worry if it looks weird in the Weebly editor. It'll look normal on your published site.
To edit or delete your image, press the "toggle" button below. Then, hover over your image until a popup appears with the "edit" and "delete" options. If you don't want a white content section, leave it blank. It will disappear on your live website.