gary1012
Expert
Expert

ESX host serial number or service tags?

I think I've seen a script in this community which will get all of the service tags/serial number from a group of ESX hosts but I can't find it now. Does anyone have a script which will do so that pulls out the serial number/service tag? If so, which version of PowerShell/PowerCLI is required?

Community Supported, Community Rewarded - Please consider marking questions answered and awarding points to the correct post. It helps us all.
0 Kudos
4 Replies
LucD
Leadership
Leadership

Do you mean this thread Read VMHosts-Serialnumber via PowerCLI....possible?

Note that the success will depend on the type of HW you are using.

Not all HW verndors provide this info in the way ESX(i) expects it.

Btw imho it's always best to run the latest versions of PowerShell and PowerCLI.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

cyfermaster
Contributor
Contributor

Try the script found in the following thread.

http://communities.vmware.com/thread/304284

It might help.

I shoud type quicker. Smiley Happy It looks like the script in the 2 links is by the same guy. Maybe check that the script is the same. If they're different, try them both.

vite1
Contributor
Contributor

Hi cyfermaster,

I saw this thread and grabbed this one which doesn't work, as my powerCLi doesn't have Get-VMHostWSManInstance as a command.

Also, the other hosts are the same model.

$Credential = Get-Credential
Get-VMHost | ForEach-Object {
  $VMHost = $_
  $PhysicalPackage = Get-VMHostWSManInstance -VMHost $_ -class CIM_PhysicalPackage -ignoreCertFailures -credential $Credential | `
    Where-Object {$_.ElementName -eq "Chassis"}
  $Report = "" | Select-Object -Property VMHost,SerialNumber
  $Report.VMHost = $VMHost.Name
  $Report.SerialNumber = $PhysicalPackage.SerialNumber
  $Report
} | Export-Csv -NoTypeInformation -UseCulture -Path c:\Temp\EsxSerialNumbers.csv

0 Kudos
LucD
Leadership
Leadership

You'll find the Get-VMHostWSManInstance function here.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos