PowerShell for Windows Admins

Oct 30 2013   3:05PM GMT

Using WQL in PowerShell

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

WMI Query Language – WQL – is used to either form a query directly or indirectly in the –Filter parameter of Get-WmiObject and Get-CimInstance.

$query = “SELECT * FROM Win32_LogicalDisk WHERE DriveType = 3″
Get-CimInstance -Query $query

OR using the –Filter parameter

Get-CimInstance -ClassName Win32_LogicalDisk -Filter “DriveType = 3″

WQL is a limited subset of SQL.

If you want to find out more there is a help file available in PowerShell 3.0 and above

get-help about_WQL -ShowWindow

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: