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 8618327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:05:00+00:00 2026-06-12T06:05:00+00:00

this is a very basic program I wanted to write a VB script which

  • 0

this is a very basic program I wanted to write a VB script which I’ll call from command line and pass in a few parameters, and the VB script should take the parameters and query some information from WMI, the code is like this:

1.strProperty = colNamedArguments.Item("Property") //this is to store the parameter
2.str..... some other parameters
3.Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & strNamespace)
4.Set colSWbemObjectSet = objSWbemServices.ExecQuery("SELECT * FROM " & strClass)
5.For Each objSWbemObject In colSWbemObjectSet
6.  wscript.echo objSWbemObject.strProperty

1 and 2. is to store the parameter 3.is to connect to the WMI 4.is to query the data needed 5 and 6.is to run through the collected data and print them out. The problem I have is that when I run the script with the correct parameters it prints out nothing, but if I replace the strProperty in line 5 with actual parameter I passed with command it works, and to test if the parameter is passing properly I have add lines of codes to print it out soon as it gets the parameter that worked. I think the line 5 is using the “strProperty” as the property to match the data but not the string value of the strProperty.

  • 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-12T06:05:01+00:00Added an answer on June 12, 2026 at 6:05 am

    If you really want what I gather from your description (access a property specified at runtime), this

      Dim sComputer : sComputer = "."
      Dim sWQL      : sWQL      = "Select * from Win32_LogicalDisk"
      Dim sProperty : sProperty = "Name" ' "DriveType"
      Dim oWMIS     : Set oWMIS = GetObject("winmgmts:" _
          & "{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")
      Dim oColl, oItem
      Set oColl = oWMIS.ExecQuery(sWQL)
      For Each oItem in oColl
          WScript.Echo sProperty & ":", oItem.Properties_(sProperty).Value
      Next
    

    output:

    Name: A:
    Name: C:
    Name: D:
    Name: E:
    Name: M:
    

    or:

    DriveType: 2
    DriveType: 3
    DriveType: 5
    DriveType: 4
    DriveType: 4
    

    should get you started: use the Properties_ ‘dictionary’ of the item.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very basic question for JUnit testing. I wrote a program which
This is a very basic program for Uni which writes user data to a
This is very basic question from programming point of view but as I am
I am trying to make a program which does a very basic calculation, but
So I have this very basic program that is trying to send an e-mail,
I have a very basic program which displays a standard Textview and a extended
I tried to run this very basic Swing program: http://download.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java and got an error:
So I have this weird looking problem: my very basic program generates an error
I know this is a very basic question, but after a few google searches
This is very basic stuff , but here goes. I find that I am

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.