Guest OS Operations - Directory Exists

Declaration

<AMVMWAREGUEST ACTIVITY="directory_exists" GUESTDIR="text" RESULTVARIABLE="text (variable name)" TIMEOUT="number" />

See Also

Guest OS Operations - Create Directory, Guest OS Operations - Create Temp File, Guest OS Operations - Delete File, Guest OS Operations - Disconnect, Guest OS Operations - File Exists, Guest OS Operations - Get File Information, Guest OS Operations - List Directory, Guest OS Operations - Rename File, Guest OS Operations - Run Program, Guest OS Operations - Run Script

Description

Determines the existence of a directory in the guest operating system and stores the results in a variable. Only absolute paths should be used for files in the guest.

NOTE: All functions that execute in a guest operating system require VMware Tools to be installed and running. Additionally, a valid guest login is required to run this activity.

Practical Usage

Can be used as a conditional statement to determine what the task should do if a specific directory exists or does not exist in the guest OS.

Parameters

Guest OS Operations Properties

Property

Type

Required

Default

Markup

Description

Guest directory path

Text

Yes

(Empty)

GUESTDIR="C:\Temp\test"

The full path and directory name on the guest operating system in which to determine existence.

NOTE: Only absolute paths should be used for files in the guest.

Timeout (seconds)

Number

No

60

TIMEOUT="20"

The maximum value in seconds that this activity should be allowed to execute before timing out.

Store result into AutoMate variable

Text

Yes

(Empty)

RESULTVARIABLE="theVar"

The name of an existing variable to store the result of whether the directory exists on the guest operating system.

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

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.

Username

Text

Yes

(Empty)

USERNAME="theUser"

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

Password

Text

Yes

(Empty)

PASSWORD="AM1DWVc+PAIZ6"

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

Guest Credentials

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 guest operating system.

Password

Text

Yes

(Empty)

GUESTPASSWORD="password"

The password for authentication on the guest operating system.

Login to console session

Yes/No

No

No

CONSOLE="yes"

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

Launch GUI

Yes/No

No

No

LAUNCHGUI="yes"

If set to YES, a GUI (Graphic User Interface) will appear on the desktop. If set to NO (default), no GUI will be launched and operations will execute in the background.

Timeout in seconds (optional)

Open VM

Number

No

60

OPENVMTIMEOUT="2"

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

Power On

Number

No

60

POWERONTIMEOUT="3"

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

VMWare Tools

Number

No

300

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

60

LOGINTIMEOUT="5"

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

Connection

Number

No

60

CONNECTIONTIMEOUT="6"

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

Session Based Parameters

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. This parameter is available only if the Provide Connection parameter is set to Session Based.

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.

 

Description: Check if guest directory "C:\temp\test" exists and store result into automate variable "theVar". Timeout is 70 seconds. Use default GuestOS session.

 

<AMVMWAREGUEST ACTIVITY="directory_exists" GUESTDIR="C:\temp\test" RESULTVARIABLE="theVar" TIMEOUT="70" />

↑ Top of Page