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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
Pauses a virtual machine. |
unpause |
|
Resumes operations of a virtual machine from where you paused normal operations. |
The vmrun Snapshot Commands and Parameters
Option | Parameters | Description |
---|---|---|
listSnapshots |
|
Lists all snapshots in a virtual machine. The showtree option displays snapshots in tree format, with children indented under their parent. |
snapshot |
|
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 |
|
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 |
or
|
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 |
|
Lists the network adapters in a virtual machine. |
addNetworkAdapter |
|
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 |
|
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 |
|
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 |
|
Lists all available port forwardings on a host network. |
setPortForwarding |
|
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 |
|
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 |
|
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 |
|
Checks whether the specified file exists in the guest operating system. VMware Tools and a valid guest login are required. |
directoryExistsInGuest |
|
Checks whether the specified directory exists in the guest operating system. VMware Tools and a valid guest login are required. |
setSharedFolderState |
|
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 |
|
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 |
removeSharedFolder |
|
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 |
enableSharedFolders |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
installTools |
|
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 |
|
Checks the status of VMware Tools in the guest. The possible states are unknown, installed, and running. |
deleteVM |
|
Deletes a virtual machine. |
clone |
|
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
|
|
Downloads a VMware Project Photon operating system virtual machine. |