Advertisement

04.23.2008 at 05:33PM PDT, ID: 23348836
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

I need to connect to Computers using WMI in VB.Net with System.Management class but having problems

Asked by wally_davis in Microsoft Visual Basic.Net

Tags: ,

I need to connect to a Computers (in a text file)  using WMI in VB.Net with System.Management class in order to read from a specific Registry Key path and retrieve a Value and run If Then condition statements based on the value I retrieve. I've created a vb.net Module since this will run from the cmd shell as a daily process. I'm currently testing this on an XP Pro desktop w/ SP2.

As soon as I hit the line that reads --> mc = New ManagementClass("StdRegProv") , all  of the properties (as I step through the code) display the Value "error: cannot obtain value". I will assume that I've defined the incorrect Registry Management Class. I also tried Win32_Registry and that didn't work.
I'm not sure if it's the way I've written the code or what. I'm looking to the Experts to help me on this one.
On a final note, I was also attempting to use the ManagementBaseObject but it said I could not access the context because it is 'Protected'. Not sure what the means either. So I'm hoping to use the ManagementObject instead.

Most grateful,
WallaceStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
-- precursor: I need to connect to the following path and retrieve the Data Value: HKEY_LOCAL_MACHINE\Software\ACME\Packages\Platform Validation Tool\2.0 and the Value Name = Install Status and Data Value = 1.
The host (below) variable gets the computer name assigned to it.
--- VB.NET CODE --- 
 
 Else
                            ' Connect to workstation 
                            Dim conOptions As New Management.ConnectionOptions
                            With conOptions
                                .Impersonation = ImpersonationLevel.Impersonate
                                .Authentication = AuthenticationLevel.Packet
                            End With
                            Dim strKeyPath As String = "Software\ACME\Packages\Platform ValidationTool\2.0"
                            Dim ms As New ManagementScope
                            Dim mc As New ManagementClass
                            Dim mbo As New ManagementObject
                            ms = New System.Management.ManagementScope("\\" & _
                                host & "\root\cimv2", conOptions)
                            ms.Connect()
                            mc = New ManagementClass("StdRegProv")
                            mc.Scope = ms
                            mbo = mc.GetMethodParameters("EnumValues")
                            mbo.SetPropertyValue("hDefKey", CType("&H" & Hex(RegistryHive.LocalMachine), Long))
                            mbo.SetPropertyValue("sSubKeyName", strKeyPath)
                            mbo.GetPropertyValue("Install Status")
                            mbo = mc.GetMethodParameters("GetStringValue")
[+][-]04.23.2008 at 06:08PM PDT, ID: 21426911

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 06:23PM PDT, ID: 21426961

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 10:56PM PDT, ID: 21428042

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 03:31PM PDT, ID: 21435766

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: VB.NET, IE 7.0 SP2
Sign Up Now!
Solution Provided By: wally_davis
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080924-EE-VQP-38 / EE_QW_2_20070628