Jump to content


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.
Photo

Remote Registry


1 reply to this topic

BRY

BRY
  • Members
  • 44 posts

Posted 08 May 2002 - 11:42

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?
Bryan Dickson
[br]Senior Software Engineer
[br]Fugro-UDI Limited

gunavelu

gunavelu
  • Members
  • 23 posts

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
Gunavelu