TimDScott
Enthusiast
Enthusiast

Derive ESXI host address from VC:VirtualMachine

Jump to solution

Hi,

I'm trying to get the ESXI host address for a given VC:VirtualMachine, can't seem to figure this out! Any ideas?

Thanks,

Tim.

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

Could you try also

var name = vm.runtime.host.name;

BTW, which vRO and vCenter plug-in versions do you use?

View solution in original post

0 Kudos
6 Replies
iiliev
VMware Employee
VMware Employee

Hi,

Try

var name = vm.hostName;

where vm is your VC:VirtualMachine object.

0 Kudos
TimDScott
Enthusiast
Enthusiast

Thanks, that was the first thing I tried, however it's null?

0 Kudos
iiliev
VMware Employee
VMware Employee

Could you try also

var name = vm.runtime.host.name;

BTW, which vRO and vCenter plug-in versions do you use?

0 Kudos
TimDScott
Enthusiast
Enthusiast

Thanks, that seems to work OK, but will this info be available if the vm is not running?

I'm using vro v7.5 with vCenter plug in v6.5.

0 Kudos
iiliev
VMware Employee
VMware Employee

Yes, I think it should work even if the vm is powered off.

0 Kudos
TimDScott
Enthusiast
Enthusiast

Just tested, works fine, thanks for your help (once again!)

0 Kudos