Using PowerShell v3.0 CIM cmdlets with VMware ESXi Hosts

I noticed that in PowerShell V3.0 some CIM cmdlets were introduced which allowed PowerShell to be able to interact with CIM providers and gather information, when importing the CIM Cmdlets into my session you can see we have a number of new cmdlets to work with:


Even though I know PowerCLI 5.1 R1 (Current release on 29th Oct 2012) does not support PowerShell v3.0 I thought I would check out what I could do with these and what information I could receive using the CIM cmdlets.

As a reminder, Carter Shanklin did some work in this area a long time ago and he ended up writing a function to be able to pull CIM information from ESX hosts, this can be found here, he also includes some links to documentation on the CIM providers the VMware hosts can provide:

As you will see from the video below the new cmdlets cut out most of the hard work Carter had to do and allow us to pull CIM information from the ESXi hosts with ease.

Using PowerShell v3.0 CIM Cmdlets with VMware ESXi Hosts from Alan Renouf on Vimeo.

For your reference, here is the code I used during this demo:

import-module CimCmdlets
$ipaddress = ""
$HostUsername = "root"
$CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl
$Session = New-CimSession -Authentication Basic -Credential $HostUsername -ComputerName $Ipaddress -port 443 -SessionOption $CIOpt
Get-CimInstance -CimSession $Session -ClassName CIM_Fan

2 thoughts on “Using PowerShell v3.0 CIM cmdlets with VMware ESXi Hosts”

Leave a Reply