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)
Please log in to answer
Posted by:
AmberSDNB
9 months ago
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.