Quantcast
Channel: VMware Communities : Discussion List - vSphere SDK for Perl
Viewing all articles
Browse latest Browse all 1577

Retrieve Power status

$
0
0

Hi there,

 

I am currently using the marvelous listVMByFolder script (http://communities.vmware.com/docs/DOC-10059), and I would like to know how I can retrieve the power status of each VM I list. I have been using the Perl SDK for about 2 days (yeah, it is not a lot), and while I understand how I would do "normally", I do not figure out how to retrieve this information while being in such a statement :

 

if ( $child_view->isa("VirtualMachine") )
{
       # Some code here
}

 

How can I retrieve this information since I am not really working on a VM object, like I would find in any tutorial out there, like something like this :


my $vms = Vim::find_entity_views(view_type => 'VirtualMachine');

foreach (@$vms) 

{

    print "VM: " . $_->config->name . ", powerstate: " . $_->runtime->powerState->val . "\n";

}

 

 

Thank you very much and have a nice day !


Viewing all articles
Browse latest Browse all 1577

Trending Articles