#PSTip Get all writeable properties of a WMI class

Not all WMI class properties can be modified. Many of these properties are read-only. Take a look at the properties and Win32_ComputerSystem, for example.

Now, how do we retrieve properties of a WMI class that are read/write capable? This can be achieved by looking at the property qualifiers. Let us see how:

$class = [wmiclass]'Win32_ComputerSystem'
$class.Properties | ForEach-Object {
      foreach ($qualifier in $_.Qualifiers) {
           if ($qualifier.Name -eq "Write") {
                $_.Name
           }
      }
}

Now, this can be easily extended to verify and list other qualifying properties such as data type, etc.

Share on: