VMware Host - List Running VMs

Declaration

<AMVMWAREVM ACTIVITY="unregister_vm" HOSTTYPE="text (options)" 
SERVER="text" USERNAME="text" PASSWORD="text (encrypted)" 
CONNECTIONTIMEOUT="number" VMPATH="text" 
TIMEOUT="number" />

Description: Retrieves all running virtual machines and populates a dataset with the results. The dataset returns plenty of information, such as  path, display name, power state, allocated memory and CPU count. Can also determine if the running VM is paused, recording, replaying, suspended and much more.

Practical Usage

Ideally used as a means to manage multiple VMs in a running state.

Connection Parameters

Property

Type

Required

Default

Markup

Description

Connection

 

 

 

 

Indicates where this activity's connection properties should originate from. Different parameters become active depending on the option selected. This is a visual parameter used only during design-time, therefore, contains no properties or markups. The available options are:

  • Host (Default) - A custom set of credentials will be entered for this activity. This option is normally selected if only a single activity is needed to perform an operation.

  • Session - Credentials derive from a session created in a previous step with the use of the Connect activity. This allows several activities to be linked to a single session, eliminating redundancy. Multiple sessions can exist in a single task.

Session

Text

Yes if Connection set to Session

VMOpsSession1

SESSION="VMO101"

The name of a session (created in a previous step) in which to link this activity. This parameter is active only if the Connection parameter is set to Session.

Host type

Text (options)

Yes if Connection set to Host

VIServer

 

  1. HOSTTYPE="Server"

  2. HOSTTYPE="Workstation"

  3. HOSTTYPE="VIServer"

  4. HOSTTYPE="Player"

The type of VM host to establish a connection with. This parameter is active only if the Connection parameter is set to Host. The available options are:

  • VMware Server (1.0x)

  • VMware Workstation

  • VMware VI Server (ESX/ESXi, vCenter, VMware Server 2.0)(Default)

  • VMware Player

Host name

Text

Yes

(Empty)

SERVER="host.server.com"

The hostname or IP address of the computer where the virtual machine is located. This parameter is active only if the Host type parameter is set to VMware Server or VMware VI Server.

Username

Text

No

(Empty)

USERNAME="MsPacman"

The username identifying a valid user account on the machine. This parameter is active only if the Host type parameter is set to VMware Server or VMware VI Server.

Password

Text

No

(Empty)

PASSWORD="encrypted"

The password identifying a valid user account on the machine. This parameter is active only if the Host type parameter is set to VMware Server or VMware VI Server.

Connection Timeout (seconds)

Number

No

60

CONNECTIONTIMEOUT="20"

The maximum time out value in seconds that this activity should wait for a response from the host.

Virtual Machine

Property

Type

Required

Default

Markup

Description

Create and populate dataset with Virtual Machine information

Text

Yes

(Empty)

RESULTATASET="theDataset"

The name of the dataset in which to create and populate with the list of running VMs. More details regarding the fields that this dataset creates can be found below under Notes.


Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset assigned is named theDataset).

Name

Type

Return Value

theDataset.CPUCount

Number

Returns the number of processors.

theDataset.IsPaused

True/False

Returns whether the running VM is paused. True if it paused, false if it is not paused.

theDataset.IsRecording

True/False

Returns true if the running VM is recording, false if it is not.

theDataset.IsReplaying

True/False

Returns true if the running VM is replaying, otherwise returns false.

theDataset.IsRunning

True/False

Returns true if the VM is running, false if it is not.

theDataset.IsSuspended

True/False

Returns true if the running VM is suspended, false if it is not.

theDataset.MemorySize

Number

Returns the total memory size allocated to the running VM.

theDataset.PathName

Text

Returns the path of the running VM. Example: [HPvd01_001] WinServer2008x64_1/WinServer2008x64.vmx

theDataset.PowerState

Number

Returns the power state of the running VM.

Expressions, Variables and Functions

All text fields allow the use of expressions such as variables, functions or extended functions, which can be entered by surrounding the expression in percentage signs (example: %FileDateTime(myVar)% or %myVar%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking theInsert Expression (%)button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions

More on the expression builder

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: This sample task retrieves all registered VMs and populates a dataset named "theDataset" with the results. It then loops through the dataset and displays the path name of each registered VM in a message box.

<AMVMWAREVM ACTIVITY="connect" HOSTTYPE="VIServer" SERVER="209.223.157.77" 
USERNAME="root" PASSWORD="AM1hd66umsQRtNbulaHHhbEOBF423belTvAaME" />
<AMVMWAREVM ACTIVITY="list_registeredvms" RESULTDATASET="theDataset" />
<AMLOOP TYPE="DATASET" DATASET="theDataset">
<AMMESSAGEBOX>%theDataset.PathName%</AMMESSAGEBOX>
</AMLOOP>
<AMVMWAREVM ACTIVITY="disconnect" />