vmware / vmware/pyvmomi

hardware.systemInfo.serialNumber Returning None

Open
#1,012 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Get ESXi host object

esxi_obj = content.searchIndex.FindByDnsName(dnsName=esxi_host, vmSearch=False)
if esxi_obj is None:
print(f'ESXi host {esxi_host} not found.')
si.Disconnect()
exit()

Retrieve hardware info from ESXi host

print(dir(esxi_obj.hardware.systemInfo))
hardware_info = esxi_obj.hardware.systemInfo
product_name = hardware_info.model
serial_number = hardware_info.serialNumber

print(f'Product name: {product_name}')
print(f'Serial number: {serial_number}')

Here product name coming properly but serial number coming empty
Product name: XXX System x32 M6 -[1111AC1]-
Serial number: None

Reproduction steps

1.from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim

Connect to vCenter or ESXi host

si = SmartConnect(host='your_host', user='your_username', pwd='your_password')

Get the host system object

content = si.RetrieveContent()
host_view = content.viewManager.CreateContainerView(content.rootFolder, [vim.HostSystem], True)
hosts = host_view.view
host = hosts[0] # assuming there is only one ESXi host in the inventory

Get the hardware system info

hardware = host.hardware
system_info = hardware.systemInfo
serial_number = system_info.serialNumber

Disconnect from vCenter or ESXi host

Disconnect(si)

print(f'The serial number of ESXi host {host.name} is {serial_number}.')

Expected behavior

serial number should get proper value but getting None

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported pyVim.connect and vim.HostSystem reproduction, then inspect host.hardware.systemInfo.serialNumber for the affected ESXi or vCenter environment. Compare the returned value with the expected host serial number; done means determining whether the binding can expose the value or documenting an environment-specific limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.