Registry.

  • Thread starter Thread starter Rob Boger
  • Start date Start date
R

Rob Boger

I've been looking and trying for hours and haven't been able to figure out
how to read/write on the registry of a remote-computer with alternate
credentials. I've can do it easily on a local computer but not remotely.

I'm trying to convert my vbscripts to a vb.net program, though I'm thinking
of staying with my scripts after trying to figure this out :)

Any help would be greatly appreciated, here is the piece of VbScript code:

SET LOCATOR = CREATEOBJECT("WBEMSCRIPTING.SWBEMLOCATOR")
SET REGISTRY_SERVICE = LOCATOR.CONNECTSERVER(TARGET, "ROOT\DEFAULT",
ADMUSR, ADMPWD)
REGISTRY_SERVICE.SECURITY_.IMPERSONATIONLEVEL = 3
SET REGISTRY = REGISTRY_SERVICE.GET("STDREGPROV")
REGISTRY.GETSTRINGVALUE &H80000001,
"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS\", "LOCAL
SETTINGS", LOCAL_SETTINGS
 
Thanks Ken,

Unfortunately I'm not very bright but looking over that example, I'm not
quite sure where or how I can input specific credentials to use. In my work
environment, we log in with our regular NT accounts, but we also have an
domain admin account that we use for doing things like modifying the
registry on a remote computer, etc. So even though I run the application on
my system, it is under my normal account, not my domain admin account. I
guess once the application is done, I could do a 'runas' to open it up, but
would prefer to be able to specify a username and password.

Am I missing something in that code?

I really appreciate your response, sorry if the above is a little
incoherent, I've been up way too long :)
Rob
 
Hi,

The line I wanted you to see is The remote computer must be running
the remote registry service.


Ken
 
* "Rob Boger said:
I've been looking and trying for hours and haven't been able to figure out
how to read/write on the registry of a remote-computer with alternate
credentials. I've can do it easily on a local computer but not remotely.

I'm trying to convert my vbscripts to a vb.net program, though I'm thinking
of staying with my scripts after trying to figure this out :)

Any help would be greatly appreciated, here is the piece of VbScript code:

SET LOCATOR = CREATEOBJECT("WBEMSCRIPTING.SWBEMLOCATOR")
SET REGISTRY_SERVICE = LOCATOR.CONNECTSERVER(TARGET, "ROOT\DEFAULT",
ADMUSR, ADMPWD)
REGISTRY_SERVICE.SECURITY_.IMPERSONATIONLEVEL = 3
SET REGISTRY = REGISTRY_SERVICE.GET("STDREGPROV")
REGISTRY.GETSTRINGVALUE &H80000001,
"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\SHELL FOLDERS\", "LOCAL
SETTINGS", LOCAL_SETTINGS

Remove the 'Set's, then try to use the code in VB.NET. Enclose the
parameter list of 'GetStringValue' into '(', ')'.
 
Back
Top