We can get the IP with a combination of 2 commands. One to list all the .vmx config files on the ESXi host. And 2, grep the hostname you are looking for to get the correct vmx to get the IP for that machine.
Here we go.
Step 1: Grab all the vmx images
root@phvlnxadm01:/root# vmware-cmd -H $vcenter_Hostname -U username@domain --vihost $esxi_hostname -l
Enter password:
/vmfs/volumes/1712a9bd-de62a9a0/fpqa-R0099-008/fpqa-R0099-008.vmx
/vmfs/volumes/1712a9bd-de62a9a0/fpqa-R0098-028/fpqa-R0098-028.vmx
/vmfs/volumes/1712a9bd-de62a9a0/fpqa-R0098-025/fpqa-R0098-025.vmx
/vmfs/volumes/1712a9bd-de62a9a0/RATVHQRTS09/RATVHQRTS09.vmx
/vmfs/volumes/1712a9bd-de62a9a0/fpqa-R0098-023/fpqa-R0098-023.vmx
/vmfs/volumes/1712a9bd-de62a9a0/capqa-R0098-001/capqa-R0098-001.vmx
Step 2: Get the IP of image for fpqa-R0099-008
root@phvlnxadm01:/root# vmware-cmd /vmfs/volumes/1712a9bd-de62a9a0/fpqa-R0099-008/fpqa-R0099-008.vmx getguestinfo ip -H $vcenter_Hostname -U username@domain --vihost $esxi_hostname
Enter password:
getguestinfo(ip) = 10.90.78.61
Problem:
We are looking for simpler process to do this. We have multiple ESXi hosts on the vCenter and would like to make with one call using vmware-cmd if we have the vCenter hostname and VM hostname. Can you assist?