/build/static/layout/Breadcrumb_cap_w.png

How to disable screensaver while powershell script is running?

The screensaver is set through group policy.

I am running a powershell script for a SCCM deployment and I need a way to prevent the screensaver for running while the PS script is executing.




0 Comments   [ + ] Show comments

Answers (1)

Posted by: AmberSDNB 1 month ago
Orange Belt
0

You could set a reg key at the beginning of the powershell script, like this:
cmd /c 'reg add "HKCU\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f'

(you could also use powershell (instead of cmd in powershell) to set the reg key but it's not going to be a 1 liner since you cannot create a registry key with properties at the same time. You need to do one, then the other in PS.

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ