vmcli: A Practical Guide for the VMware Fusion and Workstation Command Line
The command line is still the fastest way to script power state, disks, snapshots, and guest operations on with VMware Fusion (macOS) and VMware Workstation (Windows and Linux).
vmcli ships with both desktop hypervisors so you can drive the same lifecycle steps without opening the GUI.. Same lifecycle steps, no GUI.
This post covers the main modules with copy-and-paste examples.
Always confirm flags on your build with vmcli <module> --help and vmcli <vmx> <module> <command> --help, since Fusion and Workstation revisions do not always stay in lockstep.
Basic Syntax
vmcli is the cross-platform CLI for Fusion and Workstation. Each functional area (power, snapshots, storage, networking, guest operations) is a module with its own sub-commands. The usual shape is:
Important
The <vmx location> is required for commands working with VMs, and can be the first or last argument on the command line.
Global Options
| Flag | Description |
|---|---|
-v, --version | Display the version information. |
--verbose | Enable verbose logging. |
-h, --help | Display the help information. |
Default Install Locations
CI runners and daemons often lack the same PATH as an interactive shell. Point scripts at the real binary when vmcli is not on PATH:
| Platform | Typical path |
|---|---|
| macOS (Fusion) | /Applications/VMware Fusion.app/Contents/Public/vmcli |
| Windows (Workstation) | C:\Program Files\VMware\VMware Workstation\vmcli.exe (or the x86 variant on some installs) |
On Linux hosts, resolve the Workstation package path for your distro, or install location, then call that absolute path from automation.
If your host responds with vmcli: command not found, the binary is probably fine, but your PATH needs updating.
JSON Output for Scripting
Several query style commands accept -f json so you can parse output with jq or your language's JSON decoder instead of scraping plain text. Sub-command spelling is case sensitive (query vs Query), so match vmcli <module> --help on your build.
| Example | Purpose |
|---|---|
vmcli <vmx> Power query -f json | Structured power state. |
vmcli <vmx> Snapshot query -f json | Snapshot tree, UIDs, and current marker when the build supports it. |
vmcli <vmx> Guest query -f json | Guest and IP-style fields only while the VM is powered on with VMware Tools running (offline returns an error). |
vmcli <vmx> Tools Query -f json | Tools install and version status in JSON form. |
vmcli <vmx> USB Query -f json | Only on builds that list USB under vmcli --help; many Fusion vmcli trees omit USB entirely. |
If -f json is missing on a sub-command, fall back to the default text layout or upgrade the desktop hypervisor build.
Core Modules and Commands
1. Power Operations (Power module)
Stop, Suspend, and Reset need -o <opType>; other rows below do not.
| Command | Required Args | Description |
|---|---|---|
vmcli <vmx> Power Start | N/A | Start the virtual machine. |
vmcli <vmx> Power Stop | -o <opType> | Stop the virtual machine using the specified operation type. |
vmcli <vmx> Power Pause | N/A | Pause the virtual machine execution. |
vmcli <vmx> Power Unpause | N/A | Resume a paused virtual machine. |
vmcli <vmx> Power Suspend | -o <opType> | Suspend the virtual machine using the specified operation type. |
vmcli <vmx> Power Reset | -o <opType> | Reset the virtual machine using the specified operation type. |
vmcli <vmx> Power Query | N/A | Query the current power state of the VM. |
Power Start optional flags:
| Flag | Description |
|---|---|
-p, --paused | Power on in paused mode. |
-s, --soft | Power on in soft mode. |
Valid -o opType values for Stop, Suspend, and Reset:
| Value | Description |
|---|---|
hard | Immediately cut power, the same as pulling the plug. |
trySoft | Attempt a graceful OS shutdown; fall back to hard if the guest doesn't respond. |
soft | Send an ACPI shutdown signal and wait for the guest to respond. |
configDefault | Use the operation type defined in the VM's configuration. |
2. VM Management (VM & VMTemplate modules)
To create a new VM, use the VM module. Note that -g accepts a numeric preset and -c accepts any custom guest OS string.
| Flag | Required | Description |
|---|---|---|
-n, --name | Yes | Virtual machine name. |
-d, --dirpath | Yes | Directory path where the VM will be created. |
-g, --guesttype | No | Guest OS preset (numeric enum: 1–10). |
-c, --custom-guesttype | No | Any custom guest OS type string (e.g., arm-ubuntu-64, ubuntu-64). |
Example: Custom Guest OS Type
Use -c for named guest OS types such as arm-ubuntu-64 or ubuntu-64:
The VMTemplate module is used for creating and deploying VM templates natively from the command line.
3. Snapshot Management (Snapshot module)
Snapshots give you quick checkpoints for testing and rollbacks. Commands that target an existing snapshot take a <uid> integer. Run Snapshot query first to list UIDs.
| Command | Required Args | Description |
|---|---|---|
vmcli <vmx> Snapshot Take <name> | <name> | Creates a snapshot. Use -d for a description and -m to include memory state. |
vmcli <vmx> Snapshot Revert <uid> | <uid> | Revert the VM to the snapshot with the given UID. |
vmcli <vmx> Snapshot Clone <uid> <filePath> <name> | <uid>, <filePath>, <name> | Clone a snapshot to a new .vmx file. Use -l for a linked clone. |
vmcli <vmx> Snapshot Delete <uid> | <uid> | Removes the snapshot with the given UID. Use -d to also delete child snapshots. |
vmcli <vmx> Snapshot query | N/A | Lists all snapshots and their UIDs. |
!!! warning "Deleting and Reverting Snapshots" The VM must be powered off or suspended before using Snapshot Delete. Always run Snapshot query first to confirm the correct UID.
4. Hardware and Storage (Disk, Ethernet, Nvme, Sata modules)
Disk module. Create, extend, query, and configure virtual disks:
| Sub-command | Description |
|---|---|
Disk Create -f <path> -a <adapter> -s <size> -t <type> | Create a new virtual disk file. |
Disk Extend <diskLabel> <newNumSectors> | Extend an attached disk to a new size (in sectors). |
Disk query | Query the state of all disks attached to the VM. |
Disk ConnectionControl | Connect or disconnect a disk device. |
Disk SetMode | Set the persistence mode of the disk. |
Disk SetReadOnly | Mark a disk as read-only. |
Disk SetBandwidthCap | Set a bandwidth cap on the disk (bytes per second). |
Disk Branch | Create a new disk branch from the current VM state. |
Valid -a adapter types for Disk Create: ide, buslogic, lsilogic (use lsilogic for all other types).
Valid -t disk types for Disk Create:
| Type | Description |
|---|---|
0 | Single growable virtual disk. |
1 | Growable virtual disk split into multiple files. |
2 | Pre-allocated virtual disk (single file). |
3 | Pre-allocated virtual disk split into multiple files. |
Ethernet module. Configure virtual network adapters:
| Sub-command | Description |
|---|---|
Ethernet query | Query the current ethernet configuration. |
Ethernet SetNetworkName <deviceLabel> <networkName> | Connect an adapter to a named virtual network. |
Ethernet SetConnectionType <deviceLabel> <connectionType> | Set the connection type (e.g., nat, bridged, hostonly). |
Ethernet SetVirtualDevice <deviceLabel> <deviceType> | Set the virtual NIC type (e.g., vmxnet3, e1000e). |
Ethernet SetPresent <deviceLabel> <bool> | Add or remove a network adapter. |
Other Hardware Modules:
| Module | Typical starting point |
|---|---|
Nvme & Sata | Controller and attachment sub-commands vary by build; see --help. |
Serial | Port presence and backing (file, pipe, network) via --help. |
5. Configuration (ConfigParams module)
Read and write raw .vmx keys (RAM, CPU, nested virt, display name, and many hardware toggles).
| Sub-command | Description |
|---|---|
ConfigParams query | Print all current configuration entries for the VM. |
ConfigParams SetEntry <name> <value> | Write or overwrite a configuration entry. |
Set bios.forceSetupOnce to TRUE for a one-time visit to firmware or EFI setup on the next boot; the hypervisor clears it after that cycle.
6. Shared Folders (HGFS module)
The Host Guest File System (HGFS) module manages the Shared Folders feature between host and guest. VMware Tools must be installed and running in the guest.
| Sub-command | Description |
|---|---|
HGFS query | Query the current shared folder configuration. |
HGFS SetPresent <shareLabel> <bool> | Add or remove a shared folder slot (for example sharedFolder0). |
HGFS SetHostPath <shareLabel> <hostPath> | Set the host path for that slot. |
HGFS SetGuestName <shareLabel> <guestName> | Name the guest sees (for example projects). |
HGFS SetEnabled <shareLabel> <bool> | Enable or disable a share without removing it. |
HGFS SetReadAccess <shareLabel> <bool> | Control read access on the share. |
HGFS SetWriteAccess <shareLabel> <bool> | Control write access on the share. |
On many Fusion vmcli builds, HGFS sub-commands use the .vmx slot label (sharedFolder0, sharedFolder1, …), not an arbitrary string. Create the slot with SetPresent sharedFolder0 true (or matching ConfigParams entries), then set host path, guest name, and ACLs. Arbitrary labels such as projects alone are rejected until that slot exists.
7. Guest Operations (Guest module)
The Guest module executes operations directly inside a running VM. VMware Tools must be running for guest-side calls. Commands that start programs or touch the filesystem need -u <username> and -p <password>. Guest query omits -u / -p on supported builds, but the VM must still be powered on (offline returns an error). Confirm with vmcli <vmx> Guest query --help on your SKU.
| Sub-command | Description |
|---|---|
Guest query | Read guest state (for example OS string and networking) while the VM is on; combine with -f json for parsers. |
Guest run | Start a program inside the guest OS. |
Guest ps | List running processes in the guest. |
Guest kill | Terminate a process in the guest by PID. |
Guest copyTo | Copy a file from the host into the guest. |
Guest copyFrom | Copy a file from the guest back to the host. |
Guest ls | List directory contents inside the guest. |
Guest mkdir | Create a directory inside the guest. |
Guest rm / rmdir | Remove a file or directory inside the guest. |
Guest mv / mvdir | Move a file or directory inside the guest. |
Guest env | Show the guest's environment variables. |
Guest createTempFile | Create a temporary file in the guest. |
Guest createTempDir | Create a temporary directory in the guest. |
Guest toolsproperties | Show VMware Tools properties. |
8. VMware Tools (Tools module)
| Sub-command | Description |
|---|---|
Tools Query | Query the state and version of VMware Tools in the guest. |
Tools Install | Mount the VMware Tools installer in the guest. |
Tools Upgrade | Upgrade VMware Tools to the latest available version. |
9. Other Modules (MKS, Chipset, VProbes)
| Module | Description |
|---|---|
MKS | Mouse, keyboard, and screen (MKS) operations, including MKS captureScreenshot <output.png> while the VM displays video. |
Chipset | Configure low-level virtual chipset options. |
VProbes | Setup instrumentation probes inside the guest for performance analysis. |
10. USB Devices (USB module)
Some Workstation (and occasional Fusion) builds expose a USB module. vmcli --help must list USB under Available modules; otherwise every vmcli … USB … invocation fails with Invalid/unrecognized argument "USB"`.
When the module exists:
| Sub-command | Description |
|---|---|
USB Query | Inspect USB devices visible to the VM; -f json when supported. |
USB Connect <deviceId> | Attach a host USB device to the guest. |
USB Disconnect <deviceId> | Release a device from the guest. |
Device identifiers come from USB Query output; treat them as opaque strings.
11. Full VM clones (Clone module)
Separate from Snapshot Clone, some Workstation builds expose a top-level Clone module. Confirm with vmcli --help: many Fusion vmcli builds do not list Clone, so vmcli <vmx> Clone … fails the same way as a missing USB module.
Where Clone exists, sub-command names and flags have shifted across releases (CreateLinked, Create -t linked, and similar). Run vmcli Clone --help on the machine that will execute the job, then pin your automation to that text.
Practical Examples
Examples use VMX for the .vmx path and dirname "$VMX" for sibling files (extra disk, screenshots, logs). Use zsh or bash. On Windows, set VMX in the environment your script uses before each vmcli invocation.
!!! note "Where the .vmx path is" VM Create layout differs by product (flat folder vs *.vmwarevm bundle). Set VMX to the real .vmx after creation.
1. Create, tune, power on, optional firmware boot
vmcli VM Create -n test_vm -d ~/Desktop/ -c ubuntu-64
export VMX="$HOME/Desktop/test_vm.vmx"
vmcli "$VMX" ConfigParams SetEntry memsize 8192
vmcli "$VMX" ConfigParams SetEntry numvcpus 4
vmcli "$VMX" ConfigParams SetEntry vhv.enable TRUE
vmcli "$VMX" ConfigParams query | grep -E "memsize|numvcpus|vhv"
vmcli "$VMX" Power Start
# Optional: firmware or EFI setup on the *next* boot only (cleared after that boot)
# vmcli "$VMX" ConfigParams SetEntry bios.forceSetupOnce TRUE
# vmcli "$VMX" Power Start
2. Extra disk, JSON checks, screenshot
vmcli "$VMX" Disk Create \
-f "$(dirname "$VMX")/test_vm-data.vmdk" \
-a lsilogic \
-s 50GB \
-t 0
vmcli "$VMX" Disk query
# Same `-f json` calls as the table under "JSON output for scripting"
vmcli "$VMX" Power query -f json
vmcli "$VMX" Snapshot query -f json
vmcli "$VMX" Guest query -f json
vmcli "$VMX" Tools Query -f json
vmcli "$VMX" MKS captureScreenshot "$(dirname "$VMX")/test_vm-console.png"
3. Network (NAT to Bridged)
vmcli "$VMX" Ethernet query
vmcli "$VMX" Ethernet SetConnectionType ethernet0 bridged
vmcli "$VMX" Ethernet SetNetworkName ethernet0 "VMnet0"
4. Shared folders (HGFS)
shareLabel is the sharedFolderN slot (see the HGFS module table above).
vmcli "$VMX" HGFS SetPresent sharedFolder0 true
vmcli "$VMX" HGFS SetHostPath sharedFolder0 ~/Projects
vmcli "$VMX" HGFS SetGuestName sharedFolder0 projects
vmcli "$VMX" HGFS SetEnabled sharedFolder0 true
vmcli "$VMX" HGFS SetReadAccess sharedFolder0 true
vmcli "$VMX" HGFS SetWriteAccess sharedFolder0 true
5. VMware Tools
6. Snapshots
vmcli "$VMX" Snapshot Take pre-upgrade -d "State before upgrading kernel"
vmcli "$VMX" Snapshot query
vmcli "$VMX" Power Stop -o trySoft
vmcli "$VMX" Snapshot Revert 1
# VM must be off or suspended to delete snapshots
vmcli "$VMX" Snapshot Delete 1
# When you need to drop child snapshots too, use -d before the UID (see `Snapshot Delete --help` on your build)
# vmcli "$VMX" Snapshot Delete -d 1
7. Guest Operations (Credentials)
Guest run, file copy, and ps need -u and -p (see the Guest module above). Export GUEST_PASS yourself; don't paste real passwords into shell history.
!!! warning "Credential Handling" Yes, -p on the command line is ugly. So is storing the password in a script file. For automation, use environment variables or a secrets manager and pass them at runtime instead of hard-coding them.
# Set GUEST_PASS in your environment before running these lines (never log real values).
vmcli "$VMX" Guest run -u root -p "$GUEST_PASS" \
/bin/bash -c "apt-get update && apt-get upgrade -y"
vmcli "$VMX" Guest copyTo -u admin -p "$GUEST_PASS" \
/path/on/host/nginx.conf /etc/nginx/nginx.conf
vmcli "$VMX" Guest copyFrom -u admin -p "$GUEST_PASS" \
/var/log/syslog "$(dirname "$VMX")/guest-syslog.txt"
vmcli "$VMX" Guest ps -u admin -p "$GUEST_PASS"
vmcli "$VMX" Guest run -u admin -p "$GUEST_PASS" -nw \
/usr/bin/python3 /opt/scripts/bootstrap.py
Demos
Two short screen recordings from a local Fusion Ubuntu guest (paths match a *.vmwarevm bundle on macOS). Keep "$VMCLI" quoted so VMware Fusion.app paths don't split at the space.
Snapshots, Tools, Power and Guest Query

Copy Host File to Guest, then List

Treat vmcli as a thin wrapper over desktop hypervisor operations: set VMX once per script or session, call one module at a time, and lean on --help when a flag changes between Fusion and Workstation builds.
!!! tip "Quick Reference" Run vmcli <module> --help for module-level syntax, and vmcli <vmx> <module> <sub-command> --help for a specific operation.
Disclaimer
This is not an official VMware by Broadcom document. This is a personal blog post.
The information is provided as-is with no warranties and confers no rights.
Please, refer to official documentation for the most up-to-date information.
