If I know the name of a computer, is there any way I can get (read-only) access to its registry?
I need to be able to allow the user to specify a remote computer, and run software from it.
If I have the computer name supplied, then can I read from its registry to get the information I need?
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Remote Registry
Started by
BRY
, May 08 2002 11:42
1 reply to this topic
Posted 09 August 2002 - 03:57
Use WMI (Windows Management Interface) to gain access to remote registry. Be forewardned WMI comes default on NT/2000/XP as service but for 95 and others it has to be installed and configured manually. Here's an example to enumerate all software installed on a remote machine -
Dim arrSubKeys
Dim strSubKey
On Error Resume Next
ComputerName = "xyz"
Set refRegistry = GetObject("winmgmts:\\" & ComputerName & "\ROOT\default:StdRegProv")
strKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
If refRegistry.EnumKey(HKEY_LOCAL_MACHINE, strKey, arrSubKeys) = 0 Then
For Each strSubKey In arrSubKeys
Path = strKey & "\" & strSubKey
If (refRegistry.GetStringValue(HKEY_LOCAL_MACHINE, Path, "DisplayName", val) = 0) Then
MsgBox val
End If
Next
Else
MsgBox "Could not enumerate specified key."
Return
End If
Set refRegistry = Nothing
Dim arrSubKeys
Dim strSubKey
On Error Resume Next
ComputerName = "xyz"
Set refRegistry = GetObject("winmgmts:\\" & ComputerName & "\ROOT\default:StdRegProv")
strKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
If refRegistry.EnumKey(HKEY_LOCAL_MACHINE, strKey, arrSubKeys) = 0 Then
For Each strSubKey In arrSubKeys
Path = strKey & "\" & strSubKey
If (refRegistry.GetStringValue(HKEY_LOCAL_MACHINE, Path, "DisplayName", val) = 0) Then
MsgBox val
End If
Next
Else
MsgBox "Could not enumerate specified key."
Return
End If
Set refRegistry = Nothing
Gunavelu