You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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()
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
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
The text was updated successfully, but these errors were encountered: