Using WQL

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

This entry was posted in PowerShell and WMI, PowerShell V3, PowerShell v4. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s