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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:27:32+00:00 2026-05-24T07:27:32+00:00

I have a test Windows XP SP3 clean install with power shell. It’s a

  • 0

I have a test Windows XP SP3 clean install with power shell. It’s a very strange difference if i access WMI from PowerShell and from VBScript. From powershell:

Get-WmiObject 'Win32_OperatingSystem" | select Caption

This correctly displays “Windows XP Professional”. And same code written as VBScript:

WScript.Echo( GetObject( "winmgmts:Win32_OperatingSystem" ).Caption )

Displays “null” O_O. Why this happens?

  • 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-05-24T07:27:33+00:00Added an answer on May 24, 2026 at 7:27 am

    Here is the VBScript equivalent:

    Set wmi = GetObject("winmgmts:")
    Set objSet = wmi.InstancesOf("Win32_OperatingSystem")
    
    For Each obj in objSet
        WScript.Echo obj.Caption
        Exit For
    Next
    

    Although there is only one Operating System, a WMI query always returns a list.

    Ok, now, the difference – Using the Get-WmiObject cmdlet, since there is only one operation system, you get the object directly rather than a list when you do Get-WmiObject "Win32_OperatingSystem" ( use GetType to see that this is actually of type System.Management.ManagementObject )

    Since there will be multiple processes, get-wmiobject win32_process would give a array. ( use GetType to see that this is of type System.Object[]

    The following would not give any output:

    (get-wmiobject win32_process).Caption
    

    Whereas the below would:

    (get-wmiobject win32_process)[0].Caption
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very straightforward PHPUnit test in c:\kim\test\HelloTest.php on a Windows PC. I
I have a network C++ program in Windows that I'd like to test for
I'm using Visual Studio 2005 on a Windows XP SP3 machine and recently have
I have some acceptance test allows a Windows service to send an email out
We have an Windows 2008 server with IIS 7 to test sites we develop
On Windows XP system, I have test.bat C:\Path\to\php.exe -f C:\Path\to\test.php I also have test.php
I have created the following registry key (copied through regedit): HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\test I would like
I have test database and a production database. When developing I of course work
I've tryed mylyn but i cant find that feature, if anyone have test mantis
I have a test project using MbUnit and TestDriven.Net. If I right-click on an

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.