Windows – Setting Windows 7 Screensaver from Command Line

windows 7windows-registry

I'm trying to deploy a photo screensaver to several Windows 7 machines. Due to some unique restraints, I can only do it from a .bat file (no group policy). I have come up with this script:

@echo off
mkdir "c:\photos"
copy *.jpg "c:\photos"
reg delete "HKCU\Software\Microsoft\Windows Photo Viewer\Slideshow\Screensaver" /v EncryptedPIDL /f
reg add    "HKCU\Software\Microsoft\Windows Photo Viewer\Slideshow\Screensaver" /v EncryptedPIDL /t REG_SZ /d "FAAfUOBP0CDqOmkQotgIACswMJ0ZAC9DOlwAAAAAAAAAAAAAAAAAAAAAAAAAUAAxAAAAAAAdQ+ByEABwaG90b3MAADoACAAEAO++HUPNch1D4HIqAAAAF78BAAAAEAAAAAAAAAAAAAAAAAAAAHAAaABvAHQAbwBzAAAAFgAAAA==" /f
reg delete "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /f
reg add    "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d  C:Windows\System32\PhotoScreenSaver.scr /f
reg delete "HKCU\Control Panel\Desktop" /v ScreenSaveTimeOut /f
reg add    "HKCU\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 60 /f
reg delete "HKCU\Control Panel\Desktop" /v ScreenSaverIsSecure /f
reg add    "HKCU\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 1 /f
reg delete "HKCU\Control Panel\Desktop" /v ScreenSaveActive /f
reg add    "HKCU\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f
rundll32.exe user32.dll, UpdatePerUserSystemParameters

which is being run "as an administrator". The correct screen saver settings show up in the control panel dialog box, but the machines just go to the lock screen (and don't show the screen saver) when the timeout is reached. Is there another setting I'm missing? Can anyone help out, I've been struggling with this and can't make any headway. Thanks

Best Answer

Accidentally wrote:

C:Windows\System32\PhotoScreenSaver.scr

instead of:

C:\Windows\System32\PhotoScreenSaver.scr

Somehow, Windows still chose the correct screensaver in the properties dialog, but wouldn't actually work. It also added another entry called PPhotos?? My mistake just manifested very strangely.

Related Question