VMware Host - Connect
Declaration
<AMVMWAREVM ACTIVITY="connect" HOSTTYPE="text (options)" SERVER="text" USERNAME="text" PASSWORD="text (encrypted)" CONNECTIONTIMEOUT="number" SESSION="text" />
Description
Connects to the specified host and creates a session in which to associate subsequent VM steps. This activity allows simultaneous connections within a single task using the same username/password. If the virtual machine is on a host running VMware Server, you can connect to that host whether it is a local or remote host. VMware Workstation currently allows you to manipulate virtual machines only from the local host.
Practical usage
Essentially used to connect to an arbitrary host using the name of the host machine, along with a user name and password identifying a valid user account on the machine. This allows you to access any networked host machine that is running VMware Server from a single client machine.
Parameters
Connection
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Host type | Text (options) | Yes, if Connection is set to Host | VIServer |
|
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:
|
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). |
Session | Text | Yes, if Connection is set to Session | VMOpsSession1 | SESSION="VMO101" | The name of a session in which to link this activity. This parameter is active only if the Connection parameter is set to Session. |
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. |
Example
- 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 creates a VM session, powers on a VM image and creates a VM snapshot. Thereafter, it powers off the VM image and disconnects the VM connection. Comments are embedded to provide details about each operation.
<!-- Create virtual machine connection of host type "Workstation" / Create and start session named "VMOpsSession1" -->
<AMVMWAREVM ACTIVITY="connect" HOSTTYPE="Workstation" SESSION="VMOpsSession1" />
<!-- Power on virtual OS image -->
<AMVMWAREVM SESSION="VMOpsSession1" VMPATH="F:\Virtual Machines\Windows Server 2008 x64\Windows Server 2008 x64 .vmx" LAUNCHGUI="YES" />
<!-- Create a snapshot -->
<AMVMWAREVM ACTIVITY="create_snapshot" SESSION="VMOpsSession1" VMPATH="F:\VirtualMachines\Windows 10 x86\Windows 10.vmx" SNAPNAME="Test_Snapshot" SNAPDESC="Createasnapshot" INCLUDEMEMORY="YES" />
<!-- Power off virtual machine -->
<AMVMWAREVM ACTIVITY="poweroff_vm" SESSION="VMOpsSession1" VMPATH="F:\Virtual Machines\Windows7 x86\Windows 10.vmx" TIMEOUT="3" OPENVMTIMEOUT="3" SOFT="YES" TOOLSTIMEOUT="3" />
<!-- Disconnect virtual machine connection / End session -->
<AMVMWAREVM ACTIVITY="disconnect" SESSION="VMOpsSession1" />