I am looking for a way to read registry of a several remote machines. I have
an administrator username and the password of the target workstations. Here
is the code in VB.NET I have so far. However, I cannot find a way I can
specified my own credentials (a combination of admin username and password).
Can anybody give me a clue???? *sniff*
Dim MyReg As Microsoft.Win32.RegistryKey =
Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.L
ocalMachine, "MyBox")
Dim MyRegKey As Microsoft.Win32.RegistryKey
Dim MyVal
MyRegKey = MyReg.OpenSubKey("Software\Microsoft\Windows
NT\currentVersion")
MyVal = MyRegKey.GetValue("RegisteredOwner")
MyRegKey.Close()
TextBox1.Text = MyVal
Thanks in Advance!!!
Pong
Can you check these things:
1) On the remote machine, remote adminstration is enabled, and the Remote
Registry service is running. (Also you may need to be running as a user with
sufficient privileges to access the remote key, either by running the
program as such a user, or by doing impersonation of that user before
accessing the regkey)
2) The spelling of the registry key and value you want is correct. In your
posting, you were missing a space between "windows" and "nt". That will
cause MyRegKey to be assigned Null.
Assuming those, this should work for you. Good luck!
Dan & Huy
Visual Studio Team
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim MyReg As Microsoft.Win32.RegistryKey = _
Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.L
ocalMachine, "remotemachinenamehere")
Dim MyRegKey As Microsoft.Win32.RegistryKey
Dim MyVal
MyRegKey = MyReg.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion")
MyVal = MyRegKey.GetValue("RegisteredOwner")
MyRegKey.Close()
TextBox1.Text = MyVal
End Sub
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Pong Vechvitvarakul" <sumrit.vec...@charter.net> wrote in message
news:upv3h9...@corp.supernews.com...