Reply to Message

View discussion in a popup

Replying to:
Nz3k
Contributor
Contributor

Retrieve Power status

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 ! Smiley Happy

Tags (3)
Reply
0 Kudos