473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Enumerating Remote registry key values using VB.NET

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
Nov 21 '05 #1
0 4356

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Montgomery | last post by:
Does anyone have a sample block of code they can share for checking a DWORD value on a remote network machine's registry? For example, to validate a patch deployment. MSDN has a great sample for...
4
by: Chuck B | last post by:
I am modifying remote registries for about 150 computers. Is there any easy way in C# to do a remote registry backup?
1
by: Jason Richmeier | last post by:
I am attempting to set permissions on a set of registry keys on a remote computer. I am able to open the registry key on the remote computer and read values from it. However, when I call the...
0
by: =?Utf-8?B?cGhpbC5k?= | last post by:
Hi, I've a need to use remote username and password credentials to access remote registry information via VB.net, can this be done? I've currently a vbs script that periodically accesses wmi...
5
by: Sin Jeong-hun | last post by:
I need to read some registry keys of a remote computer. The key will be any key users provide. (For example : HKEY_CURRENT_USER\SOFTWARE \MyGame) I found that there was a handy method called...
8
by: Hayato Iriumi | last post by:
Hello, folks. I have a need to get the value of %windir% on a remote machine. Is it possible to get this value using C#?
8
by: ross m. greenberg | last post by:
I'm trying to emulate the look and feel of "RegEdit" under Visual Basic/VB.Net using Visual Studio 2005. Can anybody give me a pointer in the right direction: for example, what name spaces must I...
12
by: =?Utf-8?B?YXVsZGg=?= | last post by:
i current have a way to read both local and remote machines registry keys and create a textual view (.txt output). i now looking for ways to do export of local and remote mahcine registry keys...
6
tlhintoq
by: tlhintoq | last post by:
I pride myself on being able to Google just about anything but... I have fought, tried, searched and fought some more on this one. I am using VMware, and am able to debug from Visual Studio to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.