Hakime
Contributor
Contributor

VM Power Ops

Hi.

I found codes for VM Power Ops in the SDK package.

What are they meant for?

Are they codes to manage virtual machines such as Power On & Power Off the VM?

Thanks in advance for future replies.

Hakim

0 Kudos
3 Replies
lamw
Community Manager
Community Manager

Yep, you'll find that everything you can do in the VI Client can be accomplished through the VI API

Power On VM - PowerOnVM_Task() http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.VirtualMachine.html#po...

Power Off VM - PowerOffVM_Task() http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.VirtualMachine.html#po...

Suspend VM - SuspendVM_Task() http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.VirtualMachine.html#su...

....etc

If you're interested in other operations take a look at a script that provides some of the basic VM operations vmcontrol.pl http://www.vmware.com/support/developer/viperltoolkit/viperl15/doc/vmcontrol.html and you can look in the Perl script to see how the VI API is being used

Here is a list of other scripts that is part of the VI Perl Toolkit:

http://www.vmware.com/support/developer/viperltoolkit/viperl15/doc/perl_toolkit_utilities_idx.html

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

If you find this information useful, please award points for "correct" or "helpful".

admin
Immortal
Immortal

Yes you referred to the correct sample code, it does provide the functionality to perform Power operations on Virtual machine. As mentionned by William, this utility uses following api calls to perform various operations that can be performed using VI Clinet and vmcontrol.pl

PowerOffVM_Task - off

PowerOnVM_Task - on

SuspendVM_Task - suspend

ResetVM_Task - reset

RebootGuest - reboot guest.

LarryZio
Contributor
Contributor

Perhaps this is stating the obvious, but be sure to install VMware Tools for the operating system running on each virtual machine to use the VMpowerOps sample code.

0 Kudos