October 2017
Intermediate to advanced
440 pages
11h 47m
English
Commands that require instances of CIM objects can be provided with empty instances:
$cimInstance = New-Object Microsoft.Management.Infrastructure.CimInstance('Null')
The string value used by the constructor is not validated against existing WMI classes. Commands that accept CIM instances as parameters typically validate using the PSTypeNames attribute. Additional type names can be added to the list for any object as follows:
$cimInstance = New-Object Microsoft.Management.Infrastructure.CimInstance('Null')
$cimInstance | Add-Member -TypeName 'Microsoft.Management.Infrastructure.CimInstance#MSFT_Something'
TypeNames are held as an array in a hidden property of the object instance:
PS> $cimInstance.PSObject.TypeNamesMicrosoft.Management.Infrastructure.CimInstance#MSFT_Something ...
Read now
Unlock full access