Skip to content

Excluding WMI system properties with Powershell

03/07/2013

When using Windows Management Instrumentation (WMI)  in your Powershell script you will see a load of system properties returned. These are indicated by a preceding “__” (double underscore) as seen below when issuing get-wmiobject -class “Win32_Processor”:

WMI_System_Properties

 

An obvious attempt to prevent these system properties from being returned would be to use the -ExcludeProperty switch with “__*” specified. As shown though this does not achieve the desired result, the system properties are still returned:

WMI_System_Properties_Exclude

 

Strangely, well it seems strange to me on initially looking at it, you need to specifically return all properties before you can exclude any:

WMI_System_Properties_Property_Exclude

 

Now we can see how to exclude those system properties. You may on some occasion wish to return those properties but for the purposes of bringing back information for reports etc. you may wish to exclude them.

Hope this has helped, what interesting uses have you come up with for the information returned from WMI?

Advertisements

From → Powershell

Leave a Comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: