Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 232869

Re: Best way to run script / retrieve info from guest?

$
0
0

Have a look at the vim3WaitDnsNameInTools action. The following code allows to get the DNS name attributed to a VM via the VMware tools.

 

if (vm.guest != null) {
        if (vm.guest.toolsStatus == VcVirtualMachineToolsStatus.toolsOk || vm.guest.toolsStatus == VcVirtualMachineToolsStatus.toolsOld) {
            if (vm.guest.guestState == "running") {
                hostname = vm.guest.hostName;

 

Alternatives would be to use :

  • guest operation workflows (vCO 5.1 ) to run a command in the guest to retrieve its DNS name.
  • System.resolveIpaddress() (but then you need to get the VM IP address via the tools, you'd better get its DNS name in the first place).

 

Christophe.


Viewing all articles
Browse latest Browse all 232869

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>