VMware {code} Community
davidhomer1
Contributor
Contributor

ESX Host Serial Number and is my Host part of Virtual Center...?

Hello,

2 questions when using the VMWare SDK for VI3 (how) is it possible to do the following

1. Detect that the Host you are connecting to is part of a Virtual Center (the way the VI Client does when it warns you that a server is being managed by Virtual Center)

2. I can't find anything in the API that will give me the ESX host's Serial Number

Thanks,

Dave

13 Replies
tmilner
Enthusiast
Enthusiast

Dave,

The first question is easy if you're running ESX 3.5 or ESXi. Just get the HostListSummary object and pull out the managementServerIp field... (http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.host.Summary.html). You can see if using the MOB.

The second question is more difficult because I'm not sure what you want... the Host's UUID? The mother-board ID? VMware Software Serial #?

Tom

Reply
0 Kudos
davidhomer1
Contributor
Contributor

Hello - thanks for the reply.

My software automatically documents VMWare ESX Hosts including 3, 3.5 and 3i so I need a property that is available to all of them, is there another field that is available to the Version 3 of ESX?

I want the hosts physical serial number i.e. if this is a HP Proliant DL380 I can get the make and manufacturer but not its serial number. This is because my software is also used for managing hardware inventory.

Thanks,

Dave

Reply
0 Kudos
tos2k
Expert
Expert

Hi!

Possibly this can help you: http://communities.vmware.com/message/866538

Dunno where to find the serial...

Tos2k

Reply
0 Kudos
halr9000
Commander
Commander

#2: dmidecode | grep Serial

Read the contents w/o grep and you'll likely see a section starting with Base Board which is the one you want.

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
tmilner
Enthusiast
Enthusiast

Hal,

I tried this and it does work for the 3.5 systems, unfortunately, its not a solution for the ESXi systems (no console O/S). I suspect the only solution there would be via CIM. I see in the CIM_SDK that there is a serial number in the CIM_BIOSElement object but I'm not sure if that would be the same as the base board's serial number, and I'm not familiar enough with CIM to test it out.

Perhaps someone who knows CIM can post some sample code that would work on both ESX 3.5 and ESXi systems?

Tom

Reply
0 Kudos
halr9000
Commander
Commander

Good luck with that. I believe you are on the right track, but I'm not so good with CIM yet myself.

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
mjb27
Contributor
Contributor

Dave (or anyone else),

Has anyone figured out how to get the serial number from ESXi hosts? I can see the serial number in my vSphere client "Hardware Status" tab as part of the system summary, but I haven't found any way to get that through the web API yet. Just wondering if anyone has another (automated) method.

Thanks,

Maarten

Reply
0 Kudos
bhoriuchi
Enthusiast
Enthusiast

You can get it from the CIM provider using the vSphere CLI. I have modified one of the provided wsman scripts that come with the vSphere CLI to query the CIM for serial info.

Syntax is

perl get-hw-serial.pl --server <server> --username <username> --password <password>

See attached for source code.

bobqc
Contributor
Contributor

You can access by (vb.net) :

Dim host As HostSystem = ...

host.Hardware.SystemInfo.OtherIdentifyingInfo() is an array of info. Inside we can find .label = SERVICETAG and .value = hardware s/n ????.

The big problem is that OtherIdentifyingInfo() contains this information rarely (i have 2 of 29 host) and don't know why... Very embarrassing. Where is vsphere always get this information in the tab "Hardware status" ?

Reply
0 Kudos
Fjorko
Contributor
Contributor

Has anyone managed to get this working - I also get the Access denied - ecven after using alternate credentials as suggested.

I would dearly like to run this script to get the serials of all the hosts - they are all HP servers

Thanks

Reply
0 Kudos
Goll
Contributor
Contributor

In ESXi 5, I do this :

~ # esxcfg-info | head
+Host :
   \==+Hardware Info :
      |----BIOS UUID................................................0x44 0x45 0x4c 0x4c 0x33 0x0 0x10 0x43 0x80 0x37 0xb5 0xc0 0x4f 0x52 0x33 0x4a
      |----Product Name.............................................PowerEdge 2950
      |----Vendor Name..............................................Dell Inc.
      |----Serial Number............................................673A4O9E
      |----Hardware Uptime..........................................380204626458
      |----Ipmi Supported...........................................true

Or is this serial you want is something else???

Reply
0 Kudos
bhoriuchi
Enthusiast
Enthusiast

I think the goal of the thread is to get the serial using either vCLI or PowerCLI.

Reply
0 Kudos
lamw
Community Manager
Community Manager

To retireve the serial, you can use ESXCLI which is part of the vCLI install:

~ # esxcli hardware platform get
Platform Information
   UUID: 0x42 0x2e 0x6d 0x4c 0x8e 0xd5 0x53 0x7e 0x48 0xa3 0x4a 0x6f 0x53 0x27 0x65 0x62
   Product Name: VMware Virtual Platform
   Vendor Name: VMware, Inc.
   Serial Number: VMware-42 2e 6d 4c 8e d5 53 7e-48 a3 4a 6f 53 27 65 62
   IPMI Supported: false
Reply
0 Kudos