Use WMI and WQL!

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell


WMI is a great information resource, and Get-WmiObject makes it easy to retrieve WMI instances. First, use -List parameter to find WMI class names. For example, find classes that deal with network:

Get-WmiObject -List Win32_*network*

Next, pick one of the classes and enumerate its instances:

Get-WmiObject Win32_NetworkAdapterConfiguration

With WQL, a SQL-type query language for WMI, you can even create more sophisticated queries, such as:

Get-WmiObject -Query 'Select * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True'

To learn more about the specific WQL format and the keywords you can use, check this reference:

Twitter This Tip! ReTweet this Tip!

Posted Jan 19 2012, 06:00 AM by ps1
Copyright 2012 All rights reserved.