pyvmomi-community-samples icon indicating copy to clipboard operation
pyvmomi-community-samples copied to clipboard

How to get the ESXi host serial number

Open kathick opened this issue 8 years ago • 2 comments

Hello team,

I have been using vim.host.SystemIdentificationInfo to get the ESXi host serial number (physical host serial number, in my case it is Cisco UCS Blade). Sometimes it is successful but most of the times I'm not getting the serial number. What is the right method to get the ESXi host serial number. Any help?

Note: I'm connecting to vCenter, getting all the ESXi host in the cluster and for each ESXi host I'm getting enic driver, fnic driver and host serial numbers.

kathick avatar Jan 25 '17 04:01 kathick

Hello team,

Any help or comments?

kathick avatar Mar 22 '17 06:03 kathick

si = SmartConnect()
containerHost = si.content.viewManager.CreateContainerView(si.content.rootFolder, [vim.HostSystem], True)

for host in containerHost.view:
    device = {}
    device["sn"] = 'NA'
    sn = 'NA'
    for info in host.hardware.systemInfo.otherIdentifyingInfo:
        if info.identifierType.key == 'ServiceTag':
            device["sn"] = info.identifierValue

a-belhadj avatar Apr 07 '23 07:04 a-belhadj