rckngslnd Posted January 14, 2013 Posted January 14, 2013 Hi Wrote this script at home and worked perfectly , but when trying to use it on a windows 7 PC on the domain it will not write to HKEY_LOCAL_MACHINE but when i change the hex key can get it to write to the HKEY_CURRENT_USER. Please could anyone give an ideas in why this does not work?? Please see code below const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") 'set path for autologin strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" 'setting default username strValueName = "DefaultUserName" strValue = "08student" oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue 'setting password strValueName = "DefaultPassword" strValue = "password" oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue 'setting domain strValueName = "DefaultDomainName" strValue = "Windows-media" oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue 'enabling auto login, set 1 to enable and 0 to disable strValueName = "AutoAdminLogon" strValue = "1" oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
apeo Posted January 14, 2013 Posted January 14, 2013 What's the error you get? and I assume that its just a typo on this thread that all strValue variables have a space in it 'strValu e'?
rckngslnd Posted January 14, 2013 Author Posted January 14, 2013 What's the error you get? and I assume that its just a typo on this thread that all strValue variables have a space in it 'strValu e'? Hi Yes that was typo in the thread, the thing is i'm not getting an error it seems to run fine but no registry entries have been added
rckngslnd Posted January 14, 2013 Author Posted January 14, 2013 Look like it UAC blocking it, thanks for anyone that tried to help
rckngslnd Posted January 15, 2013 Author Posted January 15, 2013 I tried ti today works perectly when i tempory disable UAC, hope this helps any someone else with similar problem
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