VMware Host - Power off

Declaration

<AMVMWAREVM ACTIVITY="poweroff_vm" SESSION="text" HOSTTYPE="text (options)" SERVER="text" USERNAME="text" PASSWORD="text (encrypted)" CONNECTIONTIMEOUT="number" VMPATH="text" TIMEOUT="number" OPENVMTIMEOUT="number" SOFT="YES/NO" TOOLSTIMEOUT="number" />

Related Topics   

Description

Powers off a virtual machine from the specified host system. This is equivalent to turning off the power switch of a physical machine. Some operations on a virtual machine, such as changing the virtual hardware configuration, require that the virtual machine be powered off.

Practical usage

Usually used at the end of a task to turn off a virtual machine, typically, to conserve system resources.

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 power off. 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 VMwar Workstation for local connections.
Soft shutdown Yes/No No No SOFT="yes" If selected, the virtual machine executes shutdown procedures before powering off. If disabled (default) the virtual machine state changes without giving the guest operating system the opportunity to execute shutdown procedures (analogous to disconnecting the power to a physical computer system). To ensure an ordered power off, be sure to specify the soft option.
VMWare Tools timeout (seconds) Number No 300 TOOLSTIMEOUT="320" The maximum time period in seconds during which VMWare Tools installation must be performed or the task times out.
Timeout (seconds) Number No 300 TIMEOUT="50" The maximum time period in seconds during which this activity must be completed or the task times out.
Open VM timeout (seconds) Number No 60 OPENVMTIMEOUT="40" The maximum time period in seconds during which this activity must successfully connect to the specified VMware product or the task times out.

Description

Error Causes

On Error

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

Copy
<!-- 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\Windows 10 x86\Windows 10.vmx" TIMEOUT="3" OPENVMTIMEOUT="3" SOFT="YES" TOOLSTIMEOUT="3" />
<!-- Disconnect virtual machine connection / End session -->
<AMVMWAREVM ACTIVITY="disconnect" SESSION="VMOpsSession1" />