Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GPEDIT

Status
Not open for further replies.

MrTrue

Technical User
Jul 28, 2008
46
US
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.

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
 
Why would you not simply use Group Policy to implement the scripts the way it is designed to be done?

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Basically, I have a dept of approximately 70 users. We're allowed to use the tools available to us to make improvements or we can resource projects through IT. I have a larger script that sets a bunch of settings for each user and I want to add this portion in. After I get this finished, I can get it approved in a fraction of the time it would take me to resource and get priority. And more than anything, once I get my mind set on figuring out how to do something I really want to know how to do it!!! :)
 
Just to add to what Mark said.
If you are running a 2003 network and you don't have the option as in Server 2008, you can install CSE [client side extensions] and deploy the registry setting via either a Vista or Windows 7 PC running gpmc.msc [Group Policy Management Console]
BTW if you do this take note of the targeting I.E. Inclusive drive mapping and exclusive drive mappings.


MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top