VMware Host - List Snapshots

Declaration

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

Related Topics   

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.

Parameters

Connection

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 VMware Host - 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 is set to Session VMOpsSession1 SESSION="VMO101" The name of a session (created in a previous VWmware Host - Connect 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 is set to Host VIServer
  • HOSTTYPE="Server"
  • HOSTTYPE="Workstation"
  • HOSTTYPE="VIServer"
  • 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 (1.0x) or VMware VI Server (ESX/ESXi, vCenter, VMware Server 2.0).
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 (1.0x) or VMware VI Server (ESX/ESXi, vCenter, VMware Server 2.0).
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 (1.0x) or VMware VI Server (ESX/ESXi, vCenter, VMware Server 2.0).
Connection timeout Number No 60 CONNECTIONTIMEOUT="50" The maximum time period in seconds during which a connection must be established between the guest and host, otherwise, the step times out. The default value is 60 seconds.

Virtual Machine

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.
Create and populate dataset with VM 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 under Datasets.
Timeout (seconds) Number No 60 TIMEOUT="50" The maximum time period in seconds that this activity waits for a response from the host before a timeout error occurs.

Description

Error Causes

On Error

Additional notes

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 re-playable, false if not.
theDataset.Path Text Returns the path of the snapshot.
theDataset.PowerState Number Returns the power state of the snapshot.

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task populates a dataset with the list of available snapshots. It then loops through the dataset and displays the name associated to each snapshot in a message box.

Copy
<AMVMWAREVM ACTIVITY="connect" HOSTTYPE="VIServer" SERVER="209.223.157.77" USERNAME="root" PASSWORD="AM1hd66umsQRtNbulaHHhbEOBF423belTvAaME" />
<AMVMWAREVM ACTIVITY="list_snapshots" VMPATH="[HPvd01_001] Win10x86_1/Win10x86.vmx" RESULTDATASET="theDataset" />
<AMLOOP ACTIVITY="dataset" DATASET="theDataset" />
<AMSHOWDIALOG>%theDataset.DisplayName%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />
<AMVMWAREVM ACTIVITY="disconnect" />