AlcubierreDrive
AlcubierreDrive

Reputation: 3664

Get-WmiObject without PowerShell

I am writing a Windows python program that needs to query WMI. I am planning to do this by using the subprocess module to call WMIC with the arguments I need.

I see a lot of examples online of using WMI via PowerShell, usually using the "commandlet" Get-WmiObject or the equivalent gwmi.

How do you do the equivalent of Get-WmiObject without using PowerShell, but rather with WMIC?

Specificially, from within CMD.EXE, I want to do powershell gwmi Win32_USBControllerDevice, but without using powershell; rather, I want to invoke WMIC directly.

Thanks, and sorry for the beginner question!

Upvotes: 1

Views: 2636

Answers (2)

AlcubierreDrive
AlcubierreDrive

Reputation: 3664

From CMD.EXE, I think the command I need is wmic path Win32_USBControllerDevice get *

So most likely the general pattern is:

  • PowerShell: gwmi MYCLASSNAME
  • translates into:
  • CMD.EXE: wmic path MYCLASSNAME get *

Upvotes: 0

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200293

Any particular reason why you'd want to mess around with wmic instead of simply using python's WMI module?

Upvotes: 1

Related Questions