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: http://blogs.vmware.com/vipowershell/2009/03/monitoring-esx-hardware-with-powershell.html
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.
For your reference, here is the code I used during this demo:
import-module CimCmdlets $ipaddress = "10.20.177.15" $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