Re: Remote Registry Edit of HKEY_Current_User
From: Jeff (jeff.dykstra_at__NOSPAM_sbcusd.k12.ca.us)
Date: 05/24/04
- Next message: Emmet Gray: "Re: msinfo32.exe malfunction"
- Previous message: Marty List: "Re: error messages"
- In reply to: JeffO: "Remote Registry Edit of HKEY_Current_User"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 May 2004 11:00:35 -0700
But the only user's registry I want to modify is the user currently logged
on to the remote machine. But I have only gotten this to work if the user
on the remote machine is the same as the user on the machine I run the
script from. The account I run the script with does have admin rights to
the remote computer. Any other ideas?
Jeff
"JeffO" <anonymous@discussions.microsoft.com> wrote in message
news:ff1c01c43eb1$fca51fb0$a001280a@phx.gbl...
> Only the currently logged-on user's hive is loaded.
> All the rest are just dormant files on the hard drive.
> To get to the dormant files, you have to launch Regedit
> and load the NTUSER.DAT "hives", edit them, then unload
> them again.
> If you fail to unload them, you could cause a world of
> grief.
> And, of course, the command must be launched within an
> admin account local to the machine where the hives
> reside, or invoke an admin account residing on the
> machine where the hives are.
> You have to be extremely careful with any remote
> tampering because you could nuke the account.
>
> >-----Original Message-----
> >Is it possible to do a remote registry change to
> HKEY_Current_User? In my
> >experience I have only gotten it to work if the current
> user logged in on
> >the remote machine was the same user that runs the
> script. What I want to
> >do is be able to change the registry the actual current
> user logged in to
> >the remote computer.
> >
> >My backup plan is to use something from the command line
> like reg but I'd
> >rather use WMI.
> >Thanks,
> >Jeff
> >
> >Below is a sample of the code I've been testing:
> >
> >Option Explicit
> >
> >Dim WSHShell, RegLocate, RegLocate1, RegLocate2
> >Dim strComputer, objRegistry, regName, regName1, regName2
> >Dim regValue, regValue1, regValue2
> >Set WSHShell = WScript.CreateObject("WScript.Shell")
> >
> >const HKEY_CURRENT_USER = &H80000001
> >strComputer = "."
> >
> >
> >
> >'Define Registry Keys to be edited
> >RegLocate
> = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
> Settings"
> >RegName = "ProxyEnable"
> >RegValue=0
> >RegLocate1
> = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
> Settings"
> >RegName1 ="ProxyServer"
> >regValue1 =""
> >RegLocate2
> = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
> Settings"
> >RegName2="AutoConfigURL"
> >RegValue2="ftp://gateway/pub/proxy.pac"
> >Call ModifyDWORD
> (strComputer,HKEY_CURRENT_USER,RegLocate,RegName,RegValue)
> >Call
> >ModifyRegString
> (strComputer,HKEY_CURRENT_USER,RegLocate1,RegName1,RegValu
> e1)
> >Call
> >ModifyRegString
> (strComputer,HKEY_CURRENT_USER,RegLocate2,RegName2,RegValu
> e2)
> >
> >
> >
> >Sub ModifyDWORD
> (strComputer,strRegistryHive,strRegPath,strRegName,
> >intRegValue)
> >Dim objRegistry
> >Set objRegistry=GetObject("winmgmts:
> {impersonationLevel=impersonate}!\\"&
> >strComputer & "\root\default:StdRegProv")
> >Dim Result
> >
> >Result = objRegistry.SetDWORDValue(strRegistryHive,
> strRegPath, strRegName,
> >intRegValue)
> >
> >
> >End Sub
> >
> >
> >Sub ModifyRegString
> (strComputer,strRegistryHive,strRegPath,strRegName,
> >strRegValue)
> >Dim objRegistry
> >Set objRegistry=GetObject("winmgmts:
> {impersonationLevel=impersonate}!\\"&
> >strComputer & "\root\default:StdRegProv")
> >Dim Result
> >Result = objRegistry.SetStringValue(strRegistryHive,
> strRegPath, strRegName,
> >strRegValue)
> >
> >
> >End Sub
> >
> >
> >.
> >
- Next message: Emmet Gray: "Re: msinfo32.exe malfunction"
- Previous message: Marty List: "Re: error messages"
- In reply to: JeffO: "Remote Registry Edit of HKEY_Current_User"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|