JoCoSupport
IS-IT--Management
I have seen other threads, and on other forums, that people are having a hard time setting the Screen Saver via vbs. I have seen some very long and complex scripts, so thought i would share a more simplified one.
On Error Resume Next
Set f_objShell = CreateObject("WScript.Shell")
Reg_Key_Main = "HKEY_CURRENT_USER\Control Panel\Desktop\"
Reg_ScreenSaveActive = 1
Reg_ScreenSaverIsSecure = 1
Reg_ScreenSaveTimeOut = 600
Reg_SCRNSAVE_EXE = "C:\WINDOWS\system32\logon.scr"
f_objShell.RegWrite Reg_Key_Main & "ScreenSaveActive", Reg_ScreenSaveActive, "REG_SZ"
f_objShell.RegWrite Reg_Key_Main & "ScreenSaverIsSecure", Reg_ScreenSaverIsSecure, "REG_SZ"
f_objShell.RegWrite Reg_Key_Main & "ScreenSaveTimeOut", Reg_ScreenSaveTimeOut, "REG_SZ"
f_objShell.RegWrite Reg_Key_Main & "SCRNSAVE.EXE", Reg_SCRNSAVE_EXE, "REG_SZ"
Set f_objShell = Nothing
Err.Clear
On Error Goto 0
As you can see, this ignores all errors, so may need some tweaking depending on how you are using it. Change the variables as needed.
On Error Resume Next
Set f_objShell = CreateObject("WScript.Shell")
Reg_Key_Main = "HKEY_CURRENT_USER\Control Panel\Desktop\"
Reg_ScreenSaveActive = 1
Reg_ScreenSaverIsSecure = 1
Reg_ScreenSaveTimeOut = 600
Reg_SCRNSAVE_EXE = "C:\WINDOWS\system32\logon.scr"
f_objShell.RegWrite Reg_Key_Main & "ScreenSaveActive", Reg_ScreenSaveActive, "REG_SZ"
f_objShell.RegWrite Reg_Key_Main & "ScreenSaverIsSecure", Reg_ScreenSaverIsSecure, "REG_SZ"
f_objShell.RegWrite Reg_Key_Main & "ScreenSaveTimeOut", Reg_ScreenSaveTimeOut, "REG_SZ"
f_objShell.RegWrite Reg_Key_Main & "SCRNSAVE.EXE", Reg_SCRNSAVE_EXE, "REG_SZ"
Set f_objShell = Nothing
Err.Clear
On Error Goto 0
As you can see, this ignores all errors, so may need some tweaking depending on how you are using it. Change the variables as needed.