Guest OS Operations - Connect

Declaration

<AMVMWAREGUEST ACTIVITY="connect" SESSION="text" HOSTTYPE="text (options)" SERVER="text" VMPATH="text" GUESTUSERNAME="text" GUESTPASSWORD="text (encrypted)" LAUNCHGUI="yes/no" CONNECTIONTIMEOUT="number" OPENVMTIMEOUT="number" TOOLSTIMEOUT="number" POWERONTIMEOUT="number" LOGINTIMEOUT="number" />

See Also

Guest OS Operations - Disconnect, Guest OS Operations - File Exists, Guest OS Operations - Get Environment Variable, Guest OS Operations - Get File Information, Guest OS Operations - Get Guest Variable, Guest OS Operations - Kill Process, Guest OS Operations - List Directory, Guest OS Operations - List Process, Guest OS Operations - Login, Guest OS Operations - Logout, Guest OS Operations - Open URL, Guest OS Operations - Rename File, Guest OS Operations - Run Program, Guest OS Operations - Run Script

Description

Connects to the specified guest operating system. To work with a virtual machine, you must first connect to the host where the virtual machine is stored. If the virtual machine is on a host running VMware Workstation, you can connect to it only from a client on the same host. 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

Allows you to access any networked host machine that is running VMware Server from a single client machine.

Parameters

Connection Properties

Property

Type

Required

Default

Markup

Description

Host Type

Text (options)

Yes

VMWare Workstation

HOSTTYPE="Server"

The VMware software running on the host where the virtual machine is located. If you are using VMware Server to connect to a remote host, it does not matter which VMware product (if any) is running on the local host.

  • VMWare Server (1.0x)

  • VMWare Workstation

  • VMWare VI Server (ESX/ESXi, vCenter, VMWare Server 2.0)

  • VMWare Player

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.

VM Path

Text

Yes

(Empty)

VMPATH=

"C:\Users\{Username}\Documents

\Virtual Machines\Windows Server 2008 x86\Windows Server 2008.vmx"

The path and file name (.vmx file) to the guest operating system. For example: C:\Users\{Username}\Documents\Virtual Machines\Windows Server 2008 x86\Windows Server 2008.vmx. This parameter is active only if the Host Type parameter is set to VMWare Workstation  or VMWare Player.

Username

Text

Yes

(Empty)

GUESTUSERNAME="user"

The username for authentication on the remote machine.

Password

Text

Yes

(Empty)

GUESTPASSWORD="password"

The password for authentication on the remote machine.

Login to console session

Yes/No

No

No

CONSOLE="yes"

If set to YES, logs into a console session. This parameter is set to NO by default.

Launch GUI

Yes/No

No

No

LAUNCHGUI="yes"

If set to YES, the GUI will appear on the desktop. If set to NO (default), no GUI will be launched and the operation will execute in the background.

Timeout in seconds (optional)

Open VM

Number

No

(Empty)

OPENVMTIMEOUT="2"

The maximum time period in seconds during which this activity must be completed or the step times out.

Power On

Number

No

(Empty)

POWERONTIMEOUT="3"

The maximum time period in seconds during which the VM must power on or the step times out.

VMWare Tools

Number

No

(Empty)

TOOLSTIMEOUT="4"

The maximum time period in seconds during which VMWare Tools must start on the guest operating system or the step times out.

Login

Number

No

(Empty)

LOGINTIMEOUT="5"

The maximum time period in seconds during which the login process must be completed or the step times out.

Connection

Number

No

(Empty)

CONNECTIONTIMEOUT="6"

The maximum time period in seconds during which a connection must be established or the step times out.

Session

Text

No

GuestOSSession

SESSION="MySession"

The session name. This allows several operations to be linked to a single session, eliminating redundancy. Multiple sessions can exist in a single task.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties allows you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables and Functions

All text fields allow the use of expressions such as variables, functions or AutoMate 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 the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on function

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

This task uses several VMware Guest OS activities. It creates a session using the Connect activity, logs onto the guest VMware using the Login activity, and checks if a specific guest file exists on the host using the File Exists activity. If the guest file exists, it is copied over to the host machine using the Copy activity. The task ends with a Disconnect step. Comments are included in the task to explain each step.

 

<AMVARIABLE NAME="myVar"></AMVARIABLE>

<!-- Create a guest session. -->

<AMVMWAREGUEST ACTIVITY="connect" HOSTTYPE="Workstation" VMPATH="C:\Users\Username\Documents\Virtual Machines\Windows Server 2008 x86\Windows Server 2008 (experimental).vmx" GUESTUSERNAME="Techsupport" GUESTPASSWORD="AM1ag7WmWg7U1xbulaHHhbEOLvMrSDiPrC4aME" CONSOLE="yes" LAUNCHGUI="yes" OPENVMTIMEOUT="90" POWERONTIMEOUT="90" />

<!-- Log onto guest. -->

<AMVMWAREGUEST ACTIVITY="login" LOGINUSERNAME="Techsupport" LOGINPASSWORD="AM1ag7WmWg7U1xbulaHHhbEOLvMrSDiPrC4aME" LOGINCONSOLE="yes" TIMEOUT="3000" />

<!-- Check if a specific guest file exists. -->

<AMVMWAREGUEST ACTIVITY="file_exists" GUESTFILE="C:\Users\techsupport\Desktop\hello.txt" RESULTVARIABLE="myVar" />

<!-- If guest file exists, copy it over to the host machine. -->

<AMIF EXPRESSION="%myVar% = True">

     <AMVMWAREGUEST COPYFROM="guest_to_host" GUESTFILE="C:\Users\techsupport\Desktop\hello.txt" HOSTFILE="C:\Users\techsupport\Desktop\hello.txt" />

</AMIF>

<!-- Close Connection -->

<AMVMWAREGUEST ACTIVITY="disconnect" />

 

↑ Top of Page