The vmrun commands are divided into function categories.

The following tables list vmrun commands and parameters for Fusion according to their function. Parameters are listed one per line. Parameters enclosed in square brackets are optional. The vertical bar indicates a keyword choice.

The vmrun Power Commands and Parameters

Option Parameters Description
start

path to .vmx file

[ gui | nogui ]

Starts a virtual machine. The default gui option starts the machine interactively, which is required to display the Fusion interface. The nogui option suppresses the Fusion interface, including the startup dialog box, to allow noninteractive scripting.
Note: To start encrypted virtual machines, use the nogui flag. The vmrun utility does not support GUI mode with encrypted virtual machines.
stop

path to .vmx file

[ hard | soft ]

Stops a virtual machine. Use the soft option to power off the guest after running shutdown scripts. Use the hard option to power off the guest without running scripts, as if you pressed the power button. The default is to use the powerType value specified in the .vmx file, if present.

reset

path to .vmx file

[ hard | soft ]

Resets a virtual machine. Use the soft option to run shutdown scripts before rebooting the guest. Use the hard option to reboot the guest without running scripts, as if you pressed the reset button. The default is to use the powerType value specified in the .vmx file, if present.

suspend

path to .vmx file

[ hard | soft ]

Suspends a virtual machine without shutting down the virtual machine, so local work can resume later. The soft option suspends the guest after running system scripts. On Windows guests, these scripts release the IP address. On Linux guests, the scripts suspend networking. The hard option suspends the guest without running the scripts. The default is to use the powerType value specified in the .vmx file, if present.

To resume virtual machine operations after the suspend command finishes, use the start command. On Windows, the IP address is retrieved. On Linux, networking is restarted.

pause

path to .vmx file

Pauses a virtual machine.

unpause

path to .vmx file

Resumes operations of a virtual machine from where you paused normal operations.

The vmrun Snapshot Commands and Parameters

Option Parameters Description
listSnapshots

path to .vmx file

[ showtree ]

Lists all snapshots in a virtual machine. The showtree option displays snapshots in tree format, with children indented under their parent.

snapshot

path to .vmx file

snapshot name

Creates a snapshot of a virtual machine. Because Fusion supports multiple snapshots, you must provide the snapshot name.

Because the forward slash defines path names, do not use the slash character in a snapshot name. Otherwise, specifying the snapshot path later becomes difficult.

deleteSnapshot

path to .vmx file

snapshot name

[ andDeleteChildren ]

Removes a snapshot from a virtual machine. Because Fusion supports multiple snapshots, you must provide the snapshot name. The virtual machine must be powered off or suspended. If the snapshot has children, they become children of the deleted snapshot's parent, and subsequent snapshots continue as before from the end of the chain.

The andDeleteChildren option deletes the specified snapshot and its children recursively.

See revertToSnapshot for solutions to name conflicts.
revertToSnapshot

path to .vmx file

snapshot name

or

path to .vmx file

Snapshot/"Snapshot 2"/"Snapshot N"

Sets the virtual machine to its state at snapshot time. However if the virtual machine was powered on at the time of the snapshot, vmrun reverts it to a suspended state, but does not resume running the virtual machine.

If a snapshot has a unique name within a virtual machine, revert to that snapshot by specifying the path to the virtual machine's configuration file and the unique snapshot name.

If several snapshots have the same name, specify the snapshot by including a full pathname for the snapshot. A pathname is a series of snapshot names, separated by forward slash characters (/). Each name specifies a new snapshot in the tree. For example, the pathname Snap1/Snap2 identifies a snapshot named Snap2 that was taken from the state of a snapshot named Snap1.

The vmrun Network Adapter Commands and Parameters

Only Fusion Pro supports the network adapter commands.

Option Parameters Description
listNetworkAdapters

path to .vmx file

Lists the network adapters in a virtual machine.

addNetworkAdapter

path to .vmx file

Network adapter type

[ Host nework ]

Adds a network adapter to a virtual machine.

Note: The network adapter type can be nat, hostOnly, bridged, or custom. When the network adapter is nat, hostOnly, or bridged, the Host nework parameter is not required. Only when the network adapter type is custom, must you specify a value for the Host nework parameter. For example, vmrun addNetworkAdapter .vmx file custom vmnet3.

You must name a custom virtual network with one of the names listed in the Custom section of the Network settings panel of the virtual machine or the Fusion Network Preferences panel.

.
setNetworkAdapter

path to .vmx file

Network adapter index

Network adapter type

[ Host nework ]

Updates a network adapter in a virtual machine.

Note: The network adapter type can be nat, hostOnly, bridged, or custom. When the network adapter is nat, hostOnly, or bridged, the Host nework parameter is not required. Only when the network adapter type is custom, must you specify a value for the Host nework parameter. For example, vmrun addNetworkAdapter .vmx file custom vmnet3.

You must name a custom virtual network with one of the names listed in the Custom section of the Network settings panel of the virtual machine or the Fusion Network Preferences panel.

deleteNetworkAdapter

path to .vmx file

Network adapter index

Removes a network adapter from a virtual machine.

The vmrun Host Network Commands and Parameters

Only Fusion Pro supports the host network commands.

Option Parameters Description
listHostNetworks

Lists all networks on the host.

listPortForwardings

host network name

Lists all available port forwardings on a host network.

setPortForwarding

host network name

protocol

host port

guest ip

guest port

[Description]

Sets a port forwarding on a host network.

Note: To prevent the command from returning an error, use the sudo utility with this option. For example, sudo vmrun setPortForwarding.
deletePortForwarding

host network name

protocol

host port

Deletes a port forwarding on a host network.

Note: To prevent the command from returning an error, use the sudo utility with this option. For example, sudo vmrun deletePortForwarding.

The vmrun Guest Operating System Commands and Parameters

The timeout, which is the wait for VMware Tools, is five minutes for all guest‐related commands.

Option Parameters Description
runProgramInGuest

path to .vmx file

[ -noWait | -activeWindow | -interactive ]

program name

[ program arguments ]

Runs a specified program in the guest operating system. The -noWait option returns a prompt immediately after the program starts in the guest, rather than waiting for it to finish. This option is useful for interactive programs. The -activeWindow option ensures that the Windows GUI is visible, not minimized. It has no effect on Linux. The -interactive option forces interactive guest login. The option is useful for Windows Vista and Windows 7 or later guests to make the program visible in the console window. You must provide the full pathname of a program accessible to the guest. Also provide fully accessible path names for any files specified in the program arguments, according to the requirements of the program. VMware Tools and a valid guest login are required.

fileExistsInGuest

path to .vmx file

Checks whether the specified file exists in the guest operating system. VMware Tools and a valid guest login are required.

directoryExistsInGuest

path to .vmx file

directory path on guest

Checks whether the specified directory exists in the guest operating system. VMware Tools and a valid guest login are required.

setSharedFolderState

path to .vmx file

share name

path to folder on host

writable | readonly

Modifies the writability state of a specified folder shared between the host and a guest virtual machine. The value for the share name parameter is a mount point in the guest file system. The value for the path to folder on host parameter is the exported directory on the host. To make a shared folder writable or read-only, include the writable or readonly parameter.
addSharedFolder

path to .vmx file

share name

path to folder on host

Adds a folder to be shared between the host and guest. The virtual machine must be running for the addSharedFolder option to take effect. The value for the share name parameter is a mount point in the guest file system. The value for the path to folder on host parameter is the exported directory on the host. On Windows guests, a delay might occur before shared folders are visible to the runProgramInGuest, fileExistsInGuest, and directoryExistsInGuest options.

removeSharedFolder

path to .vmx file

share name

Removes the guest virtual machine’s access to a shared folder on the host. The virtual machine must be running for the removeSharedFolder option to take effect. The value for the share name parameter is a mount point in the guest file system.

enableSharedFolders

path to .vmx file

[runtime]

Allows the guest virtual machine, specified by the .vmx file, to share folders with its host. After enabling, run the addSharedFolder option to specify each host folder to share. The optional [runtime] argument limits the sharing of folders until the virtual machine is powered off. Otherwise, the setting persists at the next power-on.
Note: The enableSharedFolders option takes effect after the shut-down and restart of the guest. No error message appears.
disableSharedFolders

path to .vmx file

[runtime]

Prevents the guest virtual machine, specified by the .vmx file, from sharing folders with its host. The optional [runtime] argument limits the stop applied to the sharing of folders until the virtual machine is powered off. Otherwise, the setting persists at next power on.
Note: The disableSharedFolders option takes effect after the shut-down and restart of the guest. No error message appears.
listProcessesInGuest

path to .vmx file

Lists all processes running in the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest.

killProcessInGuest

path to .vmx file

process ID

Stops a specified process in the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest. The process ID can be any number listed after pid= in the output of the listProcessesInGuest option.

runScriptInGuest

path to .vmx file

[ -noWait | -activeWindow | -interactive ]

interpreter path

script text

Runs the specified command script in the guest operating system. See the runProgramInGuest entry for an explanation of options. The interpreter path option runs the script. Provide the complete text of the script, not a filename. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest.
deleteFileInGuest

path to .vmx file

path to file on guest

Deletes the given file from the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest.

createDirectoryInGuest

path to .vmx file

directory path on guest

Creates the specified directory in the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest.

deleteDirectoryInGuest

path to .vmx file

directory path on guest

Deletes the specified directory from the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest

createTempfileInGuest

path to .vmx file

Creates a temporary file in the guest operating system, and returns the path name of the temporary file created. The path name varies according to the operating system. You can run the deleteFileInGuest option to remove the file. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest.

listDirectoryInGuest

path to .vmx file

directory path on guest

Lists contents of the specified directory in the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest.

CopyFileFromHostToGuest

path to .vmx file

file path on host

file path in guest

Copies a file from the host to the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest. Specify the source filename, or host filename, before the destination filename, or guest filename.

CopyFileFromGuestToHost

path to .vmx file

file path in guest

file path on host

Copies a file from the guest operating system to the host. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest. Specify the source filename, or guest filename, before the destination filename, or host filename.

renameFileInGuest

path to .vmx file

original filename

new filename

Renames or moves a file in the guest operating system. VMware Tools and a valid guest login are required. For example, you can use the -gu and -gp options to log in to the guest. Specify the source filename, or original filename, before the destination filename.

connectNamedDevice

path to .vmx file

device name

Connects the device named in the command to the guest operating system. You can only run this command when the virtual machine is powered on. You can use device names, such as sound, serial0, Ethernet0, sata0:1, etc.

Note: After you use the vmrun connectNamedDevice command to connect a disconnected sound device to a running virtual machine, powering off the virtual machine might disconnect the sound device from the virtual machine, even though the virtual machine settings list the sound device as connected.
disconnectNamedDevice

path to .vmx file

device name

Disconnects the device named in the command from the guest operating system. You can only run this command when the virtual machine is powered on. You can use device names, such as sound, serial0, Ethernet0, sata0:1, etc.

Note: After you use the vmrun disconnectNamedDevice command to disconnect a connected sound device from a running virtual machine, powering off the virtual machine might reconnect the sound device to the virtual machine, even though the virtual machine settings list the sound device as disconnected.
captureScreen

path to .vmx file

output path on host

Captures the screen of the virtual machine to a local file. The specified output file on the host is in PNG format. A valid guest login is required. For example, you can use the -gu and -gp options to log in to the guest.

writeVariable

path to .vmx file

[ guestVar | runtimeConfig | guestEnv ]

variable name

variable value

Writes a variable to the virtual machine state or guest. You can set a non‐persistent guest variable, guestVar, a runtime configuration variable,runtimeConfig, as stored in the .vmx file, or an environment variable, guestEnv, in the guest operating system. A guest variable is a runtime‐only value that provides a simple way to pass runtime values in and out of the guest. Environment variables require VMware Tools and a valid guest login. For example, you can use the -gu and -gp options to log in to the guest. With Linux, setting the guest environment also requires root login.
readVariable

path to .vmx file

[ guestVar | runtimeConfig | guestEnv ]

variable name

Reads a variable from the virtual machine state or guest. You can get a guest variable, a runtime configuration as stored in the .vmx file, or environment variables in the guest operating system. Reading the guestEnv variable requires a valid guest login. For example, you can use the -gu and -gp options to log in to the guest. See the writeVariable entry for a description of variable types.
getGuestIPAddress

path to .vmx file

[ -wait ]

Retrieves the IP address of the guest.

When you use the [ -wait ] option, the command waits until the IP address is available. For example, the IP address is not available until the virtual machine powers on. If the network is not ready, the command returns to the command-line prompt immediately.

The vmrun General Commands and Parameters

Option Parameters Description
list

Lists all running virtual machines.

upgradevm

path to .vmx file

Upgrades a virtual machine to the current virtual hardware version. Has no effect if the virtual hardware version is the most recent supported.

Power off the virtual machine, such as with the vmrun stop command. Wait a short period of time for the command to finish. Then run the vmrun upgradevm command.

installTools

path to .vmx file

Prepares to install VMware Tools in the guest operating system. In Windows guests with autorun enabled, the VMware Tools installer starts by itself. In Linux guests without autorun, the command connects the virtual CD‐ROM drive to the VMware Tools ISO image suitable for the guest, but the installer does not start.

You must complete the installation with additional manual steps, as described in the product documentation.

checkToolsState

path to .vmx file

Checks the status of VMware Tools in the guest. The possible states are unknown, installed, and running.
deleteVM

path to .vmx file

Deletes a virtual machine.
clone

path to .vmx file

destination .vmx file path

full|linked

[-snapshot=Snapshot Name]

[-cloneName=Name]

Only Fusion Pro supports the clone option.

Creates a copy of the virtual machine.

The vmrun Template Virtual Machine Commands and Parameters

Option Parameters Description
downloadPhotonVM

path to save the downloaded VM

Downloads a VMware Project Photon operating system virtual machine.