Prev Previous Post   Next Post Next

Remote Registry Access using VB.NET to enumerate Installed Software Applications

Posted: 11-19-2004, 02:57 AM
To All:

I'm having difficulty getting the syntax correct for VB.NET to produce a
listing of all software applications on a remote PC listed in the registry
installed programs.

I'm able to get to the point where I enumerate the keys, but I can't figure
out the syntax for retrieving the values from those keys. Here's what I
have at this point:

////////////////////// BEGINNING OF CODE
/////////////////////////////////////////
Dim strComputerName As String = tbScope.Text
Dim strSubKeyName As String
Dim strValueName As String
Dim strStringValue As String = ""
Dim strValue As String
Dim strKeyPath As String =
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta ll\"
Dim objManagementScope As ManagementScope
Dim objManagementClass As ManagementClass
Dim objManagementBaseObject As ManagementBaseObject
Dim aSubKeys() As String


objManagementScope = New ManagementScope
objManagementScope.Path.Server = strComputerName
objManagementScope.Path.NamespacePath = "root\default"
objManagementScope.Options.EnablePrivileges = True
objManagementScope.Options.Impersonation =
ImpersonationLevel.Impersonate
objManagementScope.Connect()



objManagementClass = New ManagementClass("stdRegProv")
objManagementClass.Scope = objManagementScope
objManagementBaseObject =
objManagementClass.GetMethodParameters("EnumKey")
objManagementBaseObject.SetPropertyValue("hDefKey" , CType("&H" &
Hex(RegistryHive.LocalMachine), Long))
objManagementBaseObject.SetPropertyValue("sSubKeyN ame", strKeyPath)
aSubKeys = CType(objManagementClass.InvokeMethod("EnumKey",
objManagementBaseObject, Nothing).Properties.Item("sNames").Value, String())


Dim strkey As String

For Each strkey In aSubKeys
lbResults.Items.Add(strkey)
Next
////////////////////// END OF CODE /////////////////////////////////////////



In VBScript, I could use the GetStringValue as shown below to get the
Display name of a application listed in the registry:

"GetStringValue(HKLM, BASE_KEY & strKey, "DisplayName", strDisplayName)"

However, I don't know the .NET version (System.Management) of getting these
values.

If anyone has a recommendation or a code snippet to show how I can do this
in VB.NET it would be greatly welcomed.

Alan


Reply With Quote

Responses to "Remote Registry Access using VB.NET to enumerate Installed Software Applications"

 
LinkBack Thread Tools Display Modes
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote access Clay Windows XP Work Remotely 109 12-18-2008 11:37 AM
Sample ASP page to list installed software Anthony Lizza Windows XP WMI 1 08-05-2004 08:13 AM
Enumerate Profiles Dan Artuso Windows XP WMI 0 07-14-2004 04:30 PM
Remote Access from W2K? JWR Windows XP Work Remotely 2 07-12-2003 02:45 PM
Remote access thru DSL Russell DeMarco Windows XP Work Remotely 1 07-12-2003 02:42 PM