Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9015573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:46:51+00:00 2026-06-16T03:46:51+00:00

Microsoft’s article, ManagementBaseObject.Properties Property, shows how to enumerate the properties in a collection For

  • 0

Microsoft’s article, ManagementBaseObject.Properties Property, shows how to enumerate the properties in a collection

    For Each p As PropertyData In properties
        Console.WriteLine(p.Name)
        For Each q As QualifierData In p.Qualifiers
            If (q.Name.Equals("Description")) Then
                Console.WriteLine(processClass.GetPropertyQualifierValue(.Name, q.Name))
            End If 
        Next
        Console.WriteLine()
    Next 
End Function 

And This article http://msdn.microsoft.com/en-us/library/ms257359.aspx demonstrates retreiving info from WMI.

What I am trying to do is run a WMI query like “SELECT * FROM Win32_Environment”. But I can’t seem to enumerate through the collection because envVar is not a PropertyDataCollection:

Dim query As New ObjectQuery(strQuery)
Dim searcher As New ManagementObjectSearcher(scope, query)
For Each queryObj As ManagementObject In searcher.Get()
   s = s & queryObj("Name").ToString() & ": " & queryObj("VariableValue").ToString()
Next

How do I enumerate through this collection without knowing the names? I can’t seem to get it to work since queryObj is not a collection.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:46:53+00:00Added an answer on June 16, 2026 at 3:46 am

    If my memory serves me well, your loop should be something like this

    Dim searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Environment")
    Dim queryObj As ManagementObjectCollection = searcher.Get()
    For Each mo in queryObj
        Console.WriteLine("----------------")
        For Each prop in mo.Properties
            Console.WriteLine("{0}: {1}", prop.Name, prop.Value)
        Next
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Microsoft has a general purpose KB article ( Q316748 ) describing how to authenticate
Microsoft has an introduction article describing DbContext features. Some of them, like filtering related
Microsoft played safe here. In their article, Creating a Child Process with Redirected Input
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = Document; // Default file name dlg.DefaultExt =
Microsoft SQL Server seems to check column name validity, but not table name validity
Microsoft has an article ( http://support.microsoft.com/kb/835460 ) which explains how to use the Orca
Microsoft recently released to preview Azure web sites. I had been hoping that this
Microsoft declined to submit my application because I took a screen shot of the
Microsoft word allows us to add datetime stamp which will update datetime and sync
Microsoft provides a method as part of WinHTTP which allows a user to determine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.