header image


Posted by: | September 8, 2014 Comments Off on CimInstanceProperties |

If you use Get-CimInstance and examine the object returnd – you’ll find some meta-data at the end of the object:

CimClass                                  : root/cimv2:Win32_OperatingSystem
CimInstanceProperties                     : {Caption, Description, InstallDate, Name…}
CimSystemProperties                       : Microsoft.Management.Infrastructure.CimSystemProperties


Expand CimInstanceProperties


£> Get-CimInstance Win32_OperatingSystem | select -ExpandProperty CimInstanceProperties | fl *


And you’ll see an entry like this for each property

Name            : Caption
Value           : Microsoft Windows 8.1 Pro
CimType         : String
Flags           : Property, ReadOnly, NotModified
IsValueModified : False


The CimType and Flags attributes are especially useful


For instance you can use them to discover which properties can be modified:


Get-CimInstance Win32_OperatingSystem |
select -ExpandProperty CimInstanceProperties |
foreach {
$flags =   ($psitem | select -ExpandProperty Flags)  -split ", "  

if ($flags -notcontains ‘ReadOnly’){$psitem}


Remember that other properties may be modifiable via a method on the class.


You can find similar information via Get-CimClass


$class = Get-CimClass -ClassName Win32_OperatingSystem

$class.CimClassProperties |
foreach {
$flags =   ($psitem | select -ExpandProperty Flags)  -split ", "  

if ($flags -notcontains ‘ReadOnly’){$psitem}


Get-CimClass gives you the qualifiers as well as the flags. Get-CimInstance gives you the value of the property if set.

Two options with slightly different results. All the better to investigate CIM classes

under: CIM, PowerShell and WMI

Comments are closed.