How to get the serial number of the esx host e.g HP DL 585, which is displayed in the hard health status tab.
Did you already look at
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes I read this articel, but for HP Servers and esxi 4 is no way to get the serial number per powershell.
If I read it correct, than only over it is possible to get the serial number.
If it concerns an ESX server did you try ?
esxcfg-info | grep "Serial N"
If that returns the serial number you could try to use plink.exe.
But for some HW/HW types it seems that it's impossible to get the serial number via PowerShell.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Today I tried it for Dell server and powershell works. For HP not.
Could it be that it has to do, that HP alwaws brands the hardware this their hardware.
So did anyone get the serial number from IBM, Fujitsu and Cisco servers with powershell?
Why not try this script after connect-viserver ?
$esxlist = get-vmhost
foreach($Esx in $esxlist){
$esxcli=Get-EsxCli -VMHost $Esx
write-host $Esx.Name $esxcli.hardware.platform.get().SerialNumber
}
Regards
Kevin Smith
The script suggested by VKEV worked in my environment. Does the following command and argument apply to all host in a cluster?
foreach($Esx in $esxlist
Thank you
No, in $esxlist you will have all the ESXi in your vCenter.
If you only want the ESXi for a specific cluster, change that first line into
$esxlist = Get-Cluster -Name MyCluster | Get-VMHost
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Okay, thanks. While I have attention, what is the best text to purchase for a beginner in PowerCLI. Your input would be greatly appreciated.
Bobby Batts
Liposcience
919-709-9118
Well there are 2 parts in that, first you will need some intro to PowerShell.
There are some good, and free, sources available for that.
Secondly there is the PowerCLI part.
Josh's has a good list of resources, see his Resources for Getting Started with #PowerCLI Automation
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Glad it worked,
The main issues with reliably retrieving the serial number are:
- vCenter only caches the serial number in the inventory database ( hence sometimes it is not returned )
- Accessing the host serial number via CIM can return the chassis serial number as well...
If it were held in the vCenter DB things would be easier...
So I know this is an extremely old thread, but the script provided by KevD is great, except I need to export to CSV, every combination of export-csv doesn't seem to work for me, any help please?
thx
Try like this
Get-VMHost | Select Name,
@{N='Serial';E={(Get-EsxCli -VMHost $_).hardware.platform.get().SerialNumber}} |
Export-Csv serial.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD. Thank you for the extremely quick and correct response.
Thanks,
GB
Thanks Luc, I've been reading a lot of different ways of extracting the serial number but this is the syntax I've been looking for. Thanks very much!