PowerCLI

 View Only
Expand all | Collapse all

How to get the serial number of the esx host?

  • 1.  How to get the serial number of the esx host?

    Posted May 03, 2010 02:09 PM

    How to get the serial number of the esx host e.g HP DL 585, which is displayed in the hard health status tab.



  • 2.  RE: How to get the serial number of the esx host?

    Posted May 03, 2010 03:45 PM

    Did you already look at

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 3.  RE: How to get the serial number of the esx host?

    Posted May 04, 2010 04:11 PM

    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.



  • 4.  RE: How to get the serial number of the esx host?

    Posted May 04, 2010 04:17 PM

    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



  • 5.  RE: How to get the serial number of the esx host?

    Posted May 05, 2010 09:33 PM

    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?



  • 6.  RE: How to get the serial number of the esx host?

    Posted Nov 25, 2013 03:15 PM

    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



  • 7.  RE: How to get the serial number of the esx host?

    Posted Nov 26, 2013 08:06 PM


    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

    bobby.batts@lipocience.com



  • 8.  RE: How to get the serial number of the esx host?

    Posted Nov 26, 2013 08:12 PM

    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



  • 9.  RE: How to get the serial number of the esx host?

    Posted Nov 26, 2013 08:39 PM

    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



  • 10.  RE: How to get the serial number of the esx host?

    Posted Nov 26, 2013 09:18 PM

    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



  • 11.  RE: How to get the serial number of the esx host?

    Posted Nov 27, 2013 09:33 AM

    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...



  • 12.  RE: How to get the serial number of the esx host?

    Posted Feb 06, 2015 08:41 PM

    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



  • 13.  RE: How to get the serial number of the esx host?

    Posted Feb 06, 2015 09:34 PM

    Try like this

    Get-VMHost | Select Name,

        @{N='Serial';E={(Get-EsxCli -VMHost $_).hardware.platform.get().SerialNumber}} |

    Export-Csv serial.csv -NoTypeInformation -UseCulture



  • 14.  RE: How to get the serial number of the esx host?

    Posted Feb 09, 2015 12:04 AM

    LucD.  Thank you for the extremely quick and correct response.

    Thanks,

    GB



  • 15.  RE: How to get the serial number of the esx host?

    Posted Oct 29, 2015 09:20 PM

    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!