As the title indicates, I'm currently unable to retrieve a list of virtual machines with a WMI query in VBScript. Hyper-V manager is correctly identifying 3 Virtual Machines on the Host in question, but when I query WMI I only see the Host itself.
Here's a sample VBScript (courtesy of WMI Code Creator):
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\virtualization\v2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Msvm_ComputerSystem instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "ElementName: " & objItem.ElementName
Next
Output:
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
-----------------------------------
Msvm_ComputerSystem instance
-----------------------------------
Description: Microsoft Hosting Computer System
ElementName: TEST-VH
Ideas, suggestions, or rocks to look under would be greatly appreciated, thanks!