Jump to content

Recommended Posts

Posted (edited)

I have a script where I am trying to remotely change the registry entry of a computer on the network ( I have admin access to it)

This is my script:

Dim $objWMIService, $objProcess
Dim $strShell, $objProgram, $strComputer, $strExe, $strInput
$strComputer = InputBox("Enter the computername to install auto local login","Enter the computername to allow auto local login")
$strExe = RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1", "1A00", "REG_DWORD", 0)
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$objProcess = $objWMIService.Get("Win32_Process")
$objProgram = $objProcess.Methods_("Create").InParameters.SpawnInstance_
                                        $objProgram.CommandLine = $strExe

;Execute the program now at the command line.
$strShell = $objWMIService.ExecMethod( "Win32_Process", "Create", $objProgram)
MsgBox(1,"","This computer now has auto local login enabled")

If I type in my computer name it edits the registry correctly(this is to add auto local login for local intranet zones). If I type in another computer it doesnt edit that entry it the registry at all.

Any ideas on what im doing wrong?

Thanks.

Edited by Chronodark
Posted

I have a script where I am trying to remotely change the registry entry of a computer on the network ( I have admin access to it)

This is my script:

$strExe = RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1", "1A00", "REG_DWORD", 0)
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$objProcess = $objWMIService.Get("Win32_Process")
$objProgram = $objProcess.Methods_("Create").InParameters.SpawnInstance_
                                        $objProgram.CommandLine = $strExe   ;At this point $strExe = whatever the return value of RegWrite() function is.

If I type in my computer name it edits the registry correctly(this is to add auto local login for local intranet zones). If I type in another computer it doesnt edit that entry it the registry at all.

Any ideas on what im doing wrong?

Thanks.

See comments on last line of code above, and...

Since you're changing a remote registry, it looks like the RegWrite command supports this. It says "It is possible to access remote registries by using a keyname in the form "\\computername\keyname". To use this feature you must have the correct access rights on NT/2000/XP/2003."

Hope this helps.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...