stian.frostad Posted September 12 Share Posted September 12 Hi, I have created a powershell script to activate a specific screensaver, password enable it and set the idle timeout value, but it does not work when I try to run it from the PulseWay Web interface. I have also tried it from a batch script, but it does not work either. Both scripts work fine when running them directly from the local computer. The Powershell script it as follows: #Values to customize $ScreenSaveActive = 1 #set to 1 if you want the screensaver enabled, 0 to disable $TimeOutValue = 60 # number of idle seconds before screensaver gets active $ScreenSaverFile = "C:\Windows\system32\mystify.scr" # full path to screensaver file $ScreenSaverIsSecure = 1 # set to 1 if you need a password to get out of screensaver, a.k.a. unlocking the pc #If the screensaver is not compliant with $ScreenSaveActive, we reset it to the preferred value if((Get-ItemProperty -Path "hkcu:control panel\desktop" -Name "ScreenSaveActive").ScreenSaveActive -ne $ScreenSaveActive) { Set-ItemProperty -Path "hkcu:control panel\desktop" -Name "ScreenSaveActive" -Value $ScreenSaveActive } #If user set screensaver timeout to a value larger than 1200 seconds (20 minutes), we set the value back to 1200 seconds [int]$Current_TimeOutValue = (Get-ItemProperty -Path "hkcu:control panel\desktop" -Name "ScreenSaveTimeOut").ScreenSaveTimeOut if($Current_TimeOutValue -eq 0 -OR $Current_TimeOutValue -gt 1200) { Set-ItemProperty -Path "hkcu:control panel\desktop" -Name "ScreenSaveTimeOut" -value 1200 } #If no screensaver file is set or if the path doesn't exist anymore, we set it to the blank screensaver $Current_ScreenSaverFile = (Get-ItemProperty -Path "hkcu:control panel\desktop" -Name "SCRNSAVE.EXE")."SCRNSAVE.EXE" if($Current_ScreenSaverFile -eq "" -OR (Test-Path $Current_ScreenSaverFile) -eq $false) { Set-ItemProperty -Path "hkcu:control panel\desktop" -Name "SCRNSAVE.EXE" -Value $ScreenSaverFile } #If the screensaver "lock" is not compliant with $ScreenSaverIsSecure, we reset it to the preferred value if((Get-ItemProperty -Path "hkcu:control panel\desktop" -Name "ScreenSaverIsSecure").ScreenSaverIsSecure -ne $ScreenSaverIsSecure) { Set-ItemProperty -Path "hkcu:control panel\desktop" -Name "ScreenSaverIsSecure" -Value $ScreenSaverIsSecure } #Before our changes become active in the current Windows session, we need to run the following command more than 3 times for ($i=1; $i -le 4; $i++) { rundll32.exe user32.dll, UpdatePerUserSystemParameters } I have also tried this from batch script, but it does not work either. @echo off reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d C:\Windows\System32\Mystify.scr /f reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 60 /f reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 1 /f Link to comment Share on other sites More sharing options...
Administrators Paul Posted September 12 Administrators Share Posted September 12 The Pulseway service runs scripts under the local SYSTEM user. You will probably need to load the correct user registry and make changes there. -Paul StefanMcl_Pulseway 1 Link to comment Share on other sites More sharing options...
stian.frostad Posted September 13 Author Share Posted September 13 Thank you for the reply. I have just started to use PulseWay so I am not familiar with automated script running directly from the PulseWay web interface. I have about 100 computers that I have to roll out the password enabled screensaver script to and if I have to load individual user registry hives it would have to run and change the script for each computer? I was hoping that it would be possible to run it for a "group" of computers in the PulseWay web interface, but I guess thats not possible then? /Stian Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now