VMware Host - List Snapshots

Declaration

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

Description: Gathers information about existing VM snapshots and populates a dataset with the results.

Practical Usage

Commonly used as a means to manage multiple VM snapshots. With snapshots, you can save the state of your virtual system BEFORE you make risky changes like installing applications, adding a new patch, or making a configuration change.

Virtual Machine Properties

Property

Type

Required

Default

Markup

Description

Virtual machine path

Text

Yes

(Empty)

VMPATH="C:\VMFolder\VMfile.vmx"

The absolute path of the virtual machine configuration (.vmx) file in which to gather snapshots. This parameter varies by product platform. With ESX/ESXi hosts and VMware Server 2.0, use a URL of the form "https://<hostName>:<port>/sdk" where <hostName> is either the DNS name or IP address, and <port> might be optional; credentials are required even for connections made locally. With VMware Workstation, use undef to connect to the local host. With VMware Server 1.0.x, use a DNS name or IP address for remote connections, or the same as Workstation for local connections.

Timeout (seconds)

Number

No

(Empty)

TIMEOUT="50"

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

Create and populate dataset with Virtual Machine information

Text

Yes

(Empty)

RESULTDATASET="theDataset"

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

Connection Properties

These properties allow you to create a custom connection for this activity or link it to a session previously established (using the Connect activity) that contains pre-defined connection parameters.

Property

Type

Required

Default

Markup

Description

Provide Connection

 

 

 

 

Indicates where this activity's connection should originate from. Different parameters become active depending on the option selected. The available options are:

  • Custom (Default) - A custom set of credentials will be entered for this activity. Select this option if performing a single operation.

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

Host Type

Text (options)

Yes

VIServer

HOSTTYPE="Workstation"

The type of VM host to establish a connection with. The available options are:

  • VMware Server (1.0x)

  • VMware Workstation

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

  • VMware Player

This parameter is active only if the Provide Connection parameter is set to Custom.

Host

Text

Yes

(Empty)

SERVER="host.server.com"

The host name 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="theUser"

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="AM1DWVc+PAIZ6"

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

(Empty)

CONNECTIONTIMEOUT="20"

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

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.Description

Text

Returns a description of the snapshot.

theDataset.DisplayName

Text

Returns the display name associated to the snapshot.

theDataset.IsReplayable

True/False

Returns true if the snapshot is replayable, false if not.

theDataset.Path

Text

Returns the path of the snapshot.

theDataset.PowerState

Number

Returns the power state of the snapshot.

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 populates a dataset with the list of available snapshots. It then loops through the dataset and displays the display name associated to each snapshot in a message box.

<AMVMWAREVM ACTIVITY="connect" 
HOSTTYPE="VIServer" SERVER="209.223.157.77" 
 USERNAME="root" PASSWORD="AM1hd66umsQRtNbulaHHhbEOBF423belTvAaME" />
<AMVMWAREVM ACTIVITY="list_snapshots" VMPATH="[HPvd01_001] Win7x86_1/Win7x86.vmx" RESULTDATASET="theDataset" />
<AMLOOP TYPE="DATASET" DATASET="theDataset">
<AMMESSAGEBOX>%theDataset.DisplayName%</AMMESSAGEBOX>
</AMLOOP>
<AMVMWAREVM ACTIVITY="disconnect" />