Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hardware.systemInfo.serialNumber Returning None #1012

Open
arjunprakashn opened this issue Apr 4, 2023 · 1 comment
Open

hardware.systemInfo.serialNumber Returning None #1012

arjunprakashn opened this issue Apr 4, 2023 · 1 comment
Labels

Comments

@arjunprakashn
Copy link

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

@JSGUYOT
Copy link

JSGUYOT commented Apr 24, 2024

Hello,

I have a same issue, but not for all ESXI.
Can you give news for this bug ?

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants