06 January 2015

CIM cmdlets in powershell v3

In powershell v3 WMI cmdlets are replaced by CIM cmdlet which are used a little bit different then WMI cmdlets.

On example is the method invocation which cannot be done by referencing the object that contain the WMI data:

$wmi_object.method_name

CIM objects don't have all the relevant and useful methods that WMI objects have.

To discover methods that can be used for a specific class name we use:

Get-CimClass -ClassName Win32_Process | Select-Object -ExpandProperty CimClassMethods

after discovering the methods available we can invoke a method by using the Invoke-CimMethod cmdlet:

$CIMProcess | Invoke-CimMethod -MethodName Terminate

No comments:

Post a Comment