VMware {code} Community
jt30605
Contributor
Contributor
Jump to solution

Getting VMWare Tools Status with VI Perl

There is probably a very simply solution for this, but I am extremely new to writing Perl. I want to pull the VMWare Tools status as part of a larger script that pulls info for each VM in our datacenter. Here's the code i have right now:

my $tools = $vm_view->guest->toolsStatus;

if (defined $tools) {

print "VMWare Tools Status: " . $tools . "\n";

}

This pulls info about VMWare Tools, but it returns something like this : "VMWare Tools Status: VirtualMachineToolsStatus=HASH(0x6fef2bc)"

How can I simply pull the status (toolsNotInstalled, toolsNotRunning, toolsOK, toolsOld)?

Thanks,

Jaime

Tags (3)
Reply
0 Kudos
1 Solution

Accepted Solutions
ssurana
VMware Employee
VMware Employee
Jump to solution

Hi Jaime,

You simply need to use the below syntax to get the values for any Enum Constants.

my $tools = $vm_view->guest->toolsStatus->val;

Hope this helps.

~ Sidharth

View solution in original post

Reply
0 Kudos
2 Replies
ssurana
VMware Employee
VMware Employee
Jump to solution

Hi Jaime,

You simply need to use the below syntax to get the values for any Enum Constants.

my $tools = $vm_view->guest->toolsStatus->val;

Hope this helps.

~ Sidharth

Reply
0 Kudos
jt30605
Contributor
Contributor
Jump to solution

Sidharth,

Thanks, that's exactly what I needed. I knew it had to be something simple.

Jaime

Reply
0 Kudos