Hi Luc;
Thank you so much for responding. This is excellent!! Once I upgraded my PowerShell foundation to v 3.0 on my Windows 7 workstation I was able to gather the info I was looking for. Sure enough the data was embedded at the CIM layer. ![]()
I was wondering if there was a way to automate populating the "$esxiHostname" variable in the script by perhaps piping in ESXi Server Names listed within and from each vCenter or maybe by reading a manual list?? Naturally, we would prefer the automated method. Thx in advance. Below is an sample script I was able to develop using your source info:
import-module CimCmdlets
$HostReport = @()
$esxiHostname = "MyESXiHost1", "MyESXiHost2"
$HostUsername = "root"
$CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl
$Session = New-CimSession -Authentication Basic -Credential $HostUsername -ComputerName $esxiHostname -port 443 -SessionOption $CIOpt
Get-CimInstance -CimSession $Session -ClassName CIM_Chassis | % {
$Report = ""| Select HostName, Model, SerialNumber, AssetTagInfo
$Report.HostName = $_.PSComputerName
$Report.Model = $_.Model
$Report.SerialNumber = $_.SerialNumber
$Report.AssetTagInfo = $_.OtherIdentifyingInfo
$HostReport += $Report
}
$HostReport | Sort-object -Property HostName | Export-Csv ".\HostHardwareReport.csv" –NoTypeInformation
Much appreciated. Ron