Read remote registry

  • Thread starter Thread starter Slimo
  • Start date Start date
S

Slimo

Hello,

I'm searching some example of code (VB) for reading remote registry subkeys
and keys.

Thanks
 
The following code read registry for the local computer; How to change it to
read registry from remote computer?

Imports Microsoft.Win32

Module Module1

Sub Main()

' Open the Uninstall registry subkey.
Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey _
("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", False)
' Retrieve a list of installed software products.
' This list also includes some software products that are not valid.
Dim SubKeyNames() As String = Key.GetSubKeyNames()
' Declare a variable to iterate through the retrieved list of
' installed software products.
Dim Index As Integer
' Declare a variable to hold the registry subkey that correspond
' to each retrieved software product.
Dim SubKey As RegistryKey
Console.WriteLine("The following software products are installed on
this computer:")
Console.WriteLine("")
' Iterate through the retrieved software products.
For Index = 0 To Key.SubKeyCount - 1
' Open the registry subkey that corresponds to the current
software product.
' SubKeyNames(Index) contains the name of the node that
corresponds to the
' current software product.
SubKey = Registry.LocalMachine.OpenSubKey _
("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" + "\"
_
+ SubKeyNames(Index), False)
' Verify that the DisplayName exists. If the DisplayName does
not exist,
' return a null string. If the returned value is a null string,
the
' DisplayName does not exist, and the software product is not
valid.
If Not SubKey.GetValue("DisplayName", "") Is "" Then
' The current software product is valid.
' Display the DisplayName of this valid software product.
Console.WriteLine(CType(SubKey.GetValue("DisplayName", ""),
String))
End If
Next

Console.WriteLine("Press ENTER to quit.")
Console.ReadLine()

End Sub

End Module
 
You need to run this code on the client. Of course the client will need the
..NET framework installed and there will be layers of security you'll have to
deal with. (I know I wouldn't want just any web site reading my registry.)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
 
This is to collect data from a LAN (inventory the software installed on the
computers in an domain)
 
Back
Top