Skip navigation
PowerShell command prompt

Execute WQL with PowerShell

Q: How can I use PowerShell to query WMI Query Language?

A: If you want to use PowerShell to run a WMI Query Language (WQL) statement, you can use the following approach in which you replace $query with your own WQL statement:

$query = 'select TotalPhysicalMemory from Win32_ComputerSystem'
get-wmiobject -query $query -Namespace "root\CIMV2"

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish