Hello All,
How to find the ESX host running a VM guest by using the command line from within the guest
for example
i we have 3 ESX hosts ESX1 ESX2 ESX3
ESX1
vm1
vm2
ESX2
vm3
vm4
ESX3
vm5
vm6
is there a command that can be used from within vm3 to find it's ESX host
Regards
Ritesh
the guest has no idea of the underlying hardware(ESX), so you won't be able to get this information from the guest.
Guessing there isn't anything you can do via VMware Tools ?
If you pulled info from vCenter into a different CMDB , a guest could query itself that way ( to update a BGinfo Script - with the caveat that in a more fluid DRS environment , that may not always be 100% up to date )
no way from the guest. Instead look at the summary tab when the VM is highlighted and it will tell you which ESX host that VM is registered on.
To do this kind of query you need some scripting to interact with the virtual environment.
Andre
Check out this blog post for a set of tools/scripts you can run to accomplish this. It assigns a variable to the VM itself rather than something you run from within the guest, but it accomplishes the same goal.
Matt
Why not just install PowerCLI and use the VMware commands to return the information you are after?
http://www.vmware.com/support/developer/PowerCLI/index.html
Once you have this installed you would then
Connect-VIServer vCenterServerName
Get-VMHost "ESXiServer01" | Get-VM
This would return all VM's on the ESXi host ESXiServer01.
Regards,
Paul
Maybe the command should be
get-vm "VM Name" | get-vmhost