I'm writing a simple WMI query in the powershell ISE. I want to get just two fields, but I get more
Get-WmiObject -Query "select DisplayName, State from Win32_Service"
And what I get is a list of results, each has the next fields,
__GENUS : 2 __CLASS : Win32_Service __SUPERCLASS : __DYNASTY : __RELPATH : __PROPERTY_COUNT : 2 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : DisplayName : Windows Font Cache Service State : Running
I noticed that the fields all start with a double underscore, not sure if it means anything. I know I can get a better result with
Get-WmiObject -Class Win32_Service | Select-Object DisplayName, State
However, I would like to add a where
clause to this query, so I'm trying to use the -Query
option.