Monday, October 24, 2011

Managing Virtual Machines using vmware-cmd


vmware-cmd Overview
vmware-cmd was included in earlier version of the ESX Service Console. A vmware-cmd vCLI has been available since ESXi version 3.0.

IMPORTANT Older service console versions of vmware-cmd support a set of connection options and general options that differ from the options in other vCLI commands. The vmware-cmd vCLI command supports these options. The vCLI command also supports the standard vCLI --server, --username, --password, and --vihost options. vmware-cmd does not support other connection options.

Connection Options for vmware-cmd
The vmware-cmd vCLI command supports only the following connection options. Other vCLI connection options are not supported, for example, you cannot use variables because the corresponding option is not supported.

--server / -H  <host>
--vihost / -h  <target>
-O <port>>
--username / -U  <username>
--password / -P  <password>
-Q  <protocol>

General Options for vmware-cmd
The vmware-cmd vCLI command supports the following general options.
--help
-q
-v

Format for Specifying Virtual Machines
When you run vmware-cmd, the virtual machine path is usually required. You can specify the virtual machine using one of the following formats:
·         Datastore prefix style: '[ds_name] relative_path', for example:
·         '[myStorage1] testvms/VM1/VM1.vmx' (Linux)
·         "[myStorage1] testvms/VM1/VM1.vmx" (Windows)

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  "[iSCSI_Shared] RDM_VM1/RDM_VM1.vmx" getstate
Enter password:
getstate() = on

·         UUID-based path: folder/subfolder/file, for example:
·         '/vmfs/volumes/mystorage/testvms/VM1/VM1.vmx' (Linux)
·         "/vmfs/volumes/mystorage/testvms/VM1/VM1.vmx" (Windows)

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx getstate
Enter password:
getstate() = on

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/4ea4b3a6-d039ce55-83b6-000c29f15a5b/RDM_VM1/RDM_VM1.vmx getstate
Enter password:
getstate() = on

Listing and Registering Virtual Machines
Registering or unregistering a virtual machine means adding the virtual machine to the vCenter Server or ESX/ESXi host inventory or removing the virtual machine.

IMPORTANT If you register a virtual machine with a vCenter Server system, and then remove it from the ESX/ESXi host, an orphaned virtual machine results. Call vmware-cmd -s unregister with the vCenter Server system as the target to resolve the issue.

The following example scenario lists all registered virtual machines on a vCenter Server, unregisters a virtual machine, and reregisters the virtual machine.
To list, unregister, and register virtual machines
1 Run vmware-cmd -l to list all registered virtual machines on a server.
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> --vihost <esx_host> -l
The command lists the VMX file for each virtual machine.
/vmfs/volumes/<storage>/winxpPro-sp2/winxpPro-sp2.vmx
/vmfs/volumes/<storage>/RHEL-lsi/RHEL-lsi.vmx
/vmfs/volumes/<storage>/VIMA0809/VIMA0809.vmx

C:\>vmware-cmd.pl  -H vcenter -U Administrator -l
Enter password:
Target host must be specified if host is a virtual center server.

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com -l
Enter password:

/vmfs/volumes/mnt/RDM_VM1/RDM_VM1.vmx

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com -l
Enter password:
No virtual machine found.

After migrated from NFS storage to iSCSI storage.
C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com -l
Enter password:

/vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx

2 Run vmware-cmd -s unregister to remove a virtual machine from the inventory.
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> --vihost <esx_host> -s unregister /vmfs/volumes/Storage2/testvm/testvm.vmx
The system returns 0 to indicate success, 1 to indicate failure.

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com -s unregister /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx
Enter password:
unregister() = 1

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com -l
Enter password:
No virtual machine found.

NOTE When you run against a vCenter Server system, you must specify the datacenter and the resource pool to register the virtual machine in. The default datacenter is ha-datacenter and the default resource pool is Resources.
When you run against an ESX/ESXi host, you usually do not specify the resource pool and datacenter. However, if two virtual machines with the same name exist in two resource pools, you must specify the resource pool.

3 Run vmware-cmd -l again to verify that the virtual machine was removed from the inventory.
4 Run vmware-cmd -s register to add the virtual machine back to the inventory.
vmware-cmd -H <vc_server> -U <login_user -P <login_password --vihost <esx_host> -s register
/vmfs/volumes/Storage2/testvm/testvm.vmx

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com -s register /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  "Virtual Lab"  MasterDRS
Enter password:
register() =1

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com -l
Enter password:

/vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx

The system returns 0 to indicate success, 1 to indicate failure.


Retrieving Virtual Machine Attributes
vmware-cmd includes a number of options for retrieving information about a virtual machine. Each option requires that you specify the virtual machine path (see “Format for Specifying Virtual Machines” ). You must also specify connection options, which differ from other vCLI commands (see “Connection Options for vmware-cmd” ).
You can use vmware-cmd options to retrieve a number of different virtual machine attributes.
·         The getuptime option retrieves the uptime of the guest operating system on the virtual machine, in seconds.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getuptime
getuptime() = 17921

Before powering the VM on:
C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tuptime
Enter password:
getuptime() = -1

After powering the VM on:
C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tuptime
Enter password:
getuptime() = 18

·         The getproductinfo product option lists the VMware product the virtual machine runs on.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo product

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  getproductinfo product
Enter password:
getproductinfo(product) = vpx

After migrating the VM to esx2:
C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx1.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tproductinfo product
Enter password:
No virtual machine found.

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tproductinfo product
Enter password:
getproductinfo(product) = vpx

The return value is esx (VMware ESX), embeddedESX (VMware ESXi), or unknown.
·         The getproductinfo platform option lists the platform the virtual machine runs on.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo platform

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tproductinfo platform
Enter password:
getproductinfo(platform) = win32-x86

The return value is win32-x86 (x86-based Windows system, linux-x86 (x86-based Linux system), or vmnix-x86 (x86-based ESX/ESXi microkernel).
·         The getproductinfo build, getproductinfo majorversion, or getproductinfo minorversion options retrieve version information.
C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tproductinfo build
Enter password:
getproductinfo(build) = 345043

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tproductinfo majorversion
Enter password:
getproductinfo(majorversion) = 4

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
tproductinfo minorversion
Enter password:
getproductinfo(minorversion) = 1

·         The getstate option retrieves the execution state of the virtual machine, which can be on, off, suspended, or unknown.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getstate
getstate() = on

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  getstate
Enter password:
getstate() = on

The gettoolslastactive option indicates whether VMware Tools is installed and whether the guest operating system is responding normally.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ge
ttoolslastactive
Enter password:
gettoolslastactive() = 0

The command returns an integer indicating how much time has passed, in seconds, since the last heartbeat was detected from the VMware Tools service. This value is initialized to zero when a virtual machine powers on. The value stays at zero until the first heartbeat is detected. After the first heartbeat, the value is always greater than zero until the virtual machine is power cycled again. The command returns one of the following:
·         0 – VMware Tools is not installed or not running.
·         1 – Guest operating system is responding normally.
·         5 – Intermittent heartbeat. There might be a problem with the guest operating system.
·         100 – No heartbeat. Guest operating system might have stopped responding.


Managing Snapshots with vmware-cmd
A snapshot captures the entire state of the virtual machine at the time you take the snapshot. Virtual machine state includes the following aspects of the virtual machine.
·         Memory state – Contents of the virtual machine’s memory.
·         Settings state – Virtual machine settings.
·         Disk state – State of all the virtual machine’s virtual disks.
When you revert to a snapshot, you return these items to the state they were in at the time you took the snapshot. If you want the virtual machine to be running or to be shut down when you start it, make sure that it is in that state when you take the snapshot.
You can use snapshots as restoration points when you install update packages, or during a branching process, such as installing different versions of a program. Taking snapshots ensures that each installation begins from an identical baseline. The Virtual Machine Administration manual discusses snapshots in detail.

Taking Snapshots
You can take a snapshot while a virtual machine is running, shut down, or suspended. If you are in the process of suspending a virtual machine, wait until the suspend operation has finished before taking a snapshot. If a virtual machine has multiple disks in different disk modes, you must shut down the virtual machine before taking a snapshot. For example, if you have a special‐purpose configuration that requires you to use an independent disk, you must shut down the virtual machine before taking a snapshot.
To take a snapshot
1 (Optional) If the virtual machine has multiple disks in different disk modes, shut down the virtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx stop soft

2 (Optional) Check that the shut down operation has been completed.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getstate
C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  getstate
Enter password:
getstate() = on


3 Run vmware-cmd with the createsnapshot option.
You must specify the description, quiesce flag (0 or 1) and memory flag (0 or 1).
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx createsnapshot VM1Aug09  ‘test snapshot August 09’ 0 0

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  createsnapshot   SnapShot1 "Test Snap Shot" 0 0
Enter password:
createsnapshot (SnapShot1 Test Snap Shot 0 0) = 1

4 Check that the virtual machine has a snapshot using the hassnapshot option.
The call returns 1 if the virtual machine has a snapshot and returns 0 otherwise.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx hassnapshot
hassnapshot () = 1

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx hassnapshot
Enter password:
hassnapshot () = 1

Reverting and Removing Snapshots
You can use vmware-cmd to revert to the current snapshot or to remove a snapshot.
IMPORTANT You cannot use vmware-cmd to revert to a named snapshot. Use the vSphere Client to revert to a named snapshot.

Run vmware-cmd with the revertsnapshot option to revert to the current snapshot. If no snapshot exists, the command does nothing and leaves the virtual machine state unchanged.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx revertsnapshot

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  re
vertsnapshot
Enter password:
revertsnapshot () = 1

Run vmware-cmd with the removesnapshots option to remove all snapshots associated with a virtual machine. If no snapshot exists, the command does nothing.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx removesnapshots

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  re
movesnapshots
Enter password:
removesnapshot () = 1

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  ha
ssnapshot
Enter password:
hassnapshot () = 0

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  hassnapshot
Enter password:
hassnapshot () = 1


Powering Virtual Machines On and Off
You can start, reboot, stop, and suspend virtual machines using vmware-cmd. You must supply a value for the powerop_mode flag, which can be soft or hard.

IMPORTANT You must have the current version of VMware Tools installed and running in the guest operating system to use a soft power operation

Soft power operations. When you specify soft as the powerop_mode value, the result of the call depends on the operation.
Stop  vmware-cmd attempts to shut down the guest operating system, and then powers off the virtual machine.
Reset  vmware-cmd attempts to shut down the guest operating system, and then reboots the virtual machine.
Suspend  vmware-cmd attempts to run a script in the guest operating system before suspending the virtual machine.

Hard power operations. vmware-cmd immediately and unconditionally shuts down, resets, or suspends the virtual machine.

The following examples illustrate how to use vmware-cmd.
·         Start – Use the start option to power on a virtual machine or to resume a suspended virtual machine.
The powerop_mode, either hard or soft, is required.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx start soft
·         Reset – When you reset the virtual machine with the soft power_op mode (the default), the guest operating system is shut down before the reset.
·         Check that VMware tools is installed so that you can reset the virtual machine with the default power_op mode, which is soft.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive
See “Retrieving Virtual Machine Attributes” on page 91.
·         Use the reset option to shut down and restart the virtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx reset soft

If VMware Tools is not currently installed on the virtual machine, you can perform only a hard reset operation.
C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  reset soft
Enter password:
Operation cannot be performed:
SOAP Fault:
-----------
Fault string: Cannot complete operation because VMware Tools is not running in this virtual machine.
Fault detail: ToolsUnavailableFault

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  stop soft
Enter password:
Operation cannot be performed:
SOAP Fault:
-----------
Fault string: Cannot complete operation because VMware Tools is not running in this virtual machine.
Fault detail: ToolsUnavailableFault

·         Suspend – You have two options for suspending a virtual machine.
·         The suspend option with the hard powerop mode unconditionally shuts down a virtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx suspend hard
·         The suspend option with the soft powerop mode runs scripts that result in a graceful shut-down of the guest operating system and shuts down the virtual machine. VMware Tools must be installed for soft powerop_mode.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx suspend soft

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx start hard
Enter password:
start() = 1

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx getstate
Enter password:
getstate() = on

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx  stop hard
Enter password:
stop() = 1

C:\>vmware-cmd.pl  -H vcenter -U Administrator --vihost esx2.virtuallab.com  /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx getstate
Enter password:
getstate() = off


Connecting and Disconnecting Virtual Devices
You can add and remove virtual devices by using the connectdevice and disconnectdevice options. The selected guest operating system determines which of the available devices you can add to a given virtual machine.
The virtual hardware that you add appears in the hardware list that is displayed in the Virtual Machine Properties wizard.
You can reconfigure virtual machine hardware while the virtual machine is running, if the following conditions are met:
·         The virtual machine has a guest operating system that supports hot‐plug functionality. See the Guest
Operating System Installation Guide.
·         The virtual machine is using hardware version 7.
The following examples illustrate connecting and disconnecting a virtual device.
·         The connectdevice option connects the virtual IDE device CD/DVD Drive 2 to the specified virtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx connectdevice "CD/DVD Drive 2"
·         The disconnectdevice option disconnects the virtual device.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx disconnectdevice "CD/DVD Drive 2"


Retrieving User Input
You can use the answer option to prompt for user input and use the input in your script. You might use this option when you want to configure a virtual machine based on a users’s input. For example:
1 Clone a virtual machine and provide the default virtual disk type.
2 When you power on the virtual machine, it prompts for the desired virtual disk type.

Forcibly Stopping Virtual Machines
In some cases, virtual machines do not respond to the normal shutdown or stop commands. In these cases, it might be necessary to forcibly shut down the virtual machines. Forcibly shutting down a virtual machine might result in guest operating system data loss and is similar to pulling the power cable on a physical machine.
You can forcibly stop virtual machines that are not responding to normal stop operation with the esxcli vms vm kill command.
To forcibly stop a virtual machine
1 List all running virtual machines on the system to see the World ID of the virtual machine you want to stop.
esxcli vms vm list
2 Stop the virtual machine by running the following command.
esxcli vms vm kill --type <kill_type> --world-id <ID>
The command supports three --type options. Try the types sequentially (soft before hard, hard before force). The following types are supported through the --type option:
·         soft – Gives the VMX process a chance to shut down cleanly (like kill or kill -SIGTERM)
·         hard – Stops the VMX process immediately (like kill -9 or kill -SIGKILL)
·         force – Stops the VMX process when other options do not work.
If all three options do not work, reboot your ESX/ESXi host to resolve the issue.

C:\>esxcli --server esx1 --username root vms vm list
Enter password:

C:\>esxcli --server esx2 --username root vms vm list
Enter password:
RDM_VM1
  World ID: 27467
  Process ID: 0
  VMX Cartel ID: 27466
  UUID: 42 19 47 55 25 c4 d2 39-c7 03 2d 01 61 1b 09 18
  Display Name: RDM_VM1
  Config File: /vmfs/volumes/iSCSI_Shared/RDM_VM1/RDM_VM1.vmx

C:\>esxcli --server esx2 --username root vms vm kill --type hard --world-id 27467
Enter password:
true

C:\>esxcli --server esx2 --username root vms vm list
Enter password:



C:\>vmware-cmd.pl --help
   Usage: vmware-cmd <options> <vm-cfg-path> <vm-action> <arguments>
          vmware-cmd -s <options> <server-action> <arguments>

     Options:
       Connection Options:
          -H or --server <host>            specifies an ESX host or a Virtual Center
          -h or --vihost <target host>     specifies a target host if host is a virtual center
          -O <port>                        specifies an alternative port
          -Q <protocol>                    specifies an alternative protocol
          -U or --username <username>      specifies a username
          -P or --password <password>      specifies a password
          --sessionfile                    specifies a sessionfile path
          --passthroughauth                specifies a login by sspi option
          --credstore                      specifies to fetch Credential store information
          --encoding                       specifies encoding option
       General Options:
          -h More detailed help.
          -q Quiet. Minimal output
          -v Verbose.

     Server Operations:
       vmware-cmd -l
          -- lists the registered VMs
       vmware-cmd -s register <config_file_path> <datacenter> <resource pool>
          -- registers a VM
       vmware-cmd -s unregister <config_file_path>
          -- unregisters a VM


     VM Operations:
       vmware-cmd <cfg> getstate
          -- gets the execution state of the VM
       vmware-cmd <cfg> start
          -- powers on or resumes a VM.
       vmware-cmd <cfg> stop <powerop_mode>
          -- stops a VM. <powerop_mode> can be soft, hard.
       vmware-cmd <cfg> reset <powerop_mode>
          -- resets a VM. <powerop_mode> can be soft, hard.
       vmware-cmd <cfg> suspend <powerop_mode>
          -- suspends a VM. <powerop_mode> can be soft, hard.
       vmware-cmd <cfg> setguestinfo <variable> <value>
          -- sets a guest info variable
       vmware-cmd <cfg> getguestinfo <variable>
          -- retrieves the value for a guest info variable
       vmware-cmd <cfg> getproductinfo <prodinfo>
          -- gets various product information.
             <prodinfo> can be product, platform, build, majorversion or minorversion
       vmware-cmd <cfg> connectdevice <device_name>
          -- connects a virtual device to a VM
       vmware-cmd <cfg> disconnectdevice <device_name>
          -- disconnects a virtual device from a VM
       vmware-cmd <cfg> getconfigfile
          -- retrieves the path to the configuration file
       vmware-cmd <cfg> getuptime
          -- retrieves the uptime of the guest OS
       vmware-cmd <cfg> answer
          -- answers a question for a VM requesting input
       vmware-cmd <cfg> gettoolslastactive
          -- retrieves the VMware tools status.
       vmware-cmd <cfg> hassnapshot
          -- determine if VM has a snapshot
       vmware-cmd <cfg> createsnapshot <name> <description> <quiesce> <memory>
          -- creates a snapshot of a VM
       vmware-cmd <cfg> revertsnapshot
          -- revert to the last snapshot of a VM
       vmware-cmd <cfg> removesnapshots
          -- remove all snapshots of a VM

No comments: