I'm trying to use .vbs file to modify the group policy login/logout script settings so that it actually uses my login/logout scripts... I have placed the files in the folder (C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logoff\logout.vbs AND
C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logon\login.vbs)
When I use the group policy editor, the scripts run fine, I want to know how I can change the registry without using the editor though...
My attempt is below, but I keep getting a root not found error... I'm assuming it's because the 0\0\ is not in the registry until the Editor adds it, but I can't figure out how to make this work.. Thanks in advance for taking the time to review this.
C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logon\login.vbs)
When I use the group policy editor, the scripts run fine, I want to know how I can change the registry without using the editor though...
My attempt is below, but I keep getting a root not found error... I'm assuming it's because the 0\0\ is not in the registry until the Editor adds it, but I can't figure out how to make this work.. Thanks in advance for taking the time to review this.
Code:
Dim wshShell : Set wshShell = CreateObject("Wscript.Shell")
Dim RegPathLogout, RegPathLogin
RegPathLogout = "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0"
RegPathLogin = "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logon\0\0"
'write to registry-------------------------------------------
wshShell.RegWrite RegPathLogout, "logout.vbs", "REG_SZ"
wshShell.RegWrite RegPathLogin, "login.vbs", "REG_SZ"
WScript.Echo "Your settings have been updated."
WScript.Quit