Jump to content

Recommended Posts

Posted

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

Posted
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'?
Posted
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...