Skip to content
Back to skills

Vmware Vmrun

ASecurity

Control VMware VMs through vmrun and vmcli with the traps handled. Power on and off, snapshots and reverts, linked and full clones, running PowerShell, cmd or bash inside the guest and getting its output and exit code back, copying files in and out with hashes, guestinfo variables as a host-guest channel, shared folders, screenshots through vmcli, and memory dumps through vmss2core. Use whenever a task needs VMware Tools guest operations, vmrun or vmcli, or a running guest's state.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 29, 2026
developmentpythongoshellbashtesting

Works with

  • cli

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add dboudreau00/VMWare-VNC-Control-for-Claude --skill vmware-vmrun --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vmware Vmrun?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vmware Vmrun
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dboudreau00-vmware-vmrun/badge)](https://www.skillsdirectory.com/skills/dboudreau00-vmware-vmrun)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vmware-vmrun
description: Control VMware VMs through vmrun and vmcli with the traps handled. Power on and off, snapshots and reverts, linked and full clones, running PowerShell, cmd or bash inside the guest and getting its output and exit code back, copying files in and out with hashes, guestinfo variables as a host-guest channel, shared folders, screenshots through vmcli, and memory dumps through vmss2core. Use whenever a task needs VMware Tools guest operations, vmrun or vmcli, or a running guest's state.
license: MIT
compatibility: VMware Workstation 17 or later (measured on 26.0), Player (fewer commands), or Fusion; guest operations need VMware Tools or open-vm-tools; Python 3.10+.
---

# vmrun and vmcli, safely

`${CLAUDE_SKILL_DIR}/vmctl.py` wraps vmrun (and vmcli where it helps). Below,
`vmctl.py` means `python "${CLAUDE_SKILL_DIR}/vmctl.py"`. A VM argument may be a
`.vmx` or the folder that holds exactly one. Options go before or after the
command. Full command list: [reference.md](reference.md).

```bash
vmctl.py doctor                       # finds vmrun, vmcli, vdiskmanager, vmss2core
vmctl.py list
vmctl.py status VM.vmx [--json]       # running, Tools, IP, VNC, serial
vmctl.py start VM.vmx [--wait-tools 900]
vmctl.py stop VM.vmx [--hard]
vmctl.py wait-tools VM.vmx --timeout 900
```

## Guest credentials

Guest operations log on to the guest. Credentials come from
`--guest-user` and `--guest-password-file`, or `VMCTL_GUEST_USER` and
`VMCTL_GUEST_PASSWORD_FILE`, or `guest-user.txt` and `guest-password.txt` next
to the `.vmx` (what `mkvm.py` writes). The password is read from a file and
scrubbed from everything vmctl prints. vmrun itself receives it as `-gp` on its
command line, visible to other host processes for the length of each call.

## Run commands in the guest

```bash
vmctl.py run VM.vmx -- 'uname -a; df -h /'                  # Linux: bash
vmctl.py run VM.vmx --sudo -- 'apt-get -y install tcpdump'  # needs passwordless sudo
vmctl.py run VM.vmx -- 'Get-Service VMTools'                # Windows: PowerShell
vmctl.py run VM.vmx --shell cmd -- 'ver & exit /b 3'
vmctl.py run VM.vmx --script-file setup.ps1 --timeout 3600 --evidence ev/
vmctl.py run VM.vmx --detach -- 'long-job.sh'               # returns at once
vmctl.py run VM.vmx --interactive --detach --shell cmd -- 'start "" notepad.exe'
```

How it works, and why: vmrun returns no output, so the script is copied into
the guest (`/tmp/vmctl` or `C:\Windows\Temp\vmctl`), run with its output
redirected to a log, and the log and an exit-code file are copied back. On
Windows the wrapper goes in as `powershell -EncodedCommand`, so no quoting is
lost between the host shell, vmrun and the guest. Measured on a Windows 10
guest: exit codes, `throw` (exit 1 with the error text), non-terminating
errors, 150-character lines and non-ASCII text all came back intact.

- `run` exits with the guest program's exit code; 125 means the run itself
  failed (no credentials, Tools not running, wrong password).
- `--evidence DIR` keeps the script, the output and the exit code.
- `--detach` (Linux) starts the job under `setsid nohup` with every stream
  redirected; (Windows) uses `-noWait`. Pull its `.log` and `.rc` later.
  A job backgrounded inside runScriptInGuest has been seen to die when the
  script returned (Ubuntu guest, October 2026); in a November 2026 retest a
  plain `nohup ... > /dev/null 2>&1 &` job survived. `--detach` survives either way.
- `--interactive` runs in the logged-on user's desktop session, for GUI
  programs. It needs that user logged on at the console: right after a reboot
  vmrun answered *"The specified guest user must be logged in interactively"*
  until autologon finished.
- On Windows, a local administrator gets a filtered token in guest operations
  while UAC is on. `mkvm.py` turns UAC off (EnableLUA=0) in lab VMs; after
  that, `whoami /groups` in a guest operation showed High Mandatory Level.

## Files

```bash
vmctl.py push VM.vmx local.zip 'C:\lab\local.zip'      # prints size and SHA-256
vmctl.py pull VM.vmx /var/log/syslog ./out/            # a folder works as target
vmctl.py exists VM.vmx /etc/cloud                      # file, directory or absent (exit 1)
vmctl.py ls VM.vmx /tmp ; vmctl.py ps VM.vmx ; vmctl.py kill VM.vmx 1581
```

One file per call; zip a tree and unpack it with `run`.

## guestinfo: a channel with no network

```bash
vmctl.py var set VM.vmx stage ready              # host -> guest
vmctl.py run VM.vmx -- 'vmware-rpctool "info-get guestinfo.stage"'
vmctl.py run VM.vmx -- 'vmware-rpctool "info-set guestinfo.result ok"'
vmctl.py var get VM.vmx result                   # guest -> host: prints ok
```

On Windows the guest side is `"C:\Program Files\VMware\VMware Tools\rpctool.exe"`.
Values set at run time live in the VMX process, not the `.vmx` file. Any guest
user can read them, so never put a secret there.

## Snapshots and clones

```bash
vmctl.py snapshot VM.vmx clean
vmctl.py snapshots VM.vmx [--tree]
vmctl.py revert VM.vmx clean
vmctl.py delete-snapshot VM.vmx clean [--children]
vmctl.py clone VM.vmx ../copy/copy.vmx linked --snapshot base-off --name copy
```

Measured on Workstation 26:

- Reverting to a snapshot taken while the VM ran leaves the VM suspended at
  that point; `start` resumes it.
- `clone` needs the source powered off, and a linked clone needs a snapshot
  taken **while the VM was off**. From a snapshot taken while it ran, vmrun
  answered *"The virtual machine should not be powered on. It is already
  running."* with the VM stopped. vmctl explains that message.
- A linked clone is a few MB (a delta disk on the snapshot); it breaks if the
  source's snapshot is deleted.

## Screenshots and keys without VNC

```bash
vmctl.py screenshot VM.vmx shot.png     # vmcli MKS captureScreenshot, then vmrun captureScreen
```

`vmcli VM.vmx MKS captureScreenshot` needs no credentials and no `.vmx` change.
It captured VMware's EFI boot menu, so it works below the guest OS.
`vmcli VM.vmx MKS sendKeySequence "text"` typed plain text at a Linux console.
`sendKeyEvent` takes `<hidcode> <modifier>`, but with USB HID usage codes it had
no effect in testing; use `vnc.py` for special keys.

## Memory dumps

```bash
vmctl.py memdump VM.vmx --out dumps/ --resume                    # suspend, convert, resume
vmctl.py memdump VM.vmx --out dumps/ --via snapshot --delete-snapshot
```

`--via suspend` hard-suspends, runs `vmss2core -W8` (Windows) or `-M` (physical
memory, others) on the `.vmss` and `.vmem`, prints each output's SHA-256, and
with `--resume` powers back on. A 4 GB Windows 10 guest took 28 s and produced
a `memory.dmp` that `kd -z` opened as a complete kernel dump. `--via snapshot`
keeps the VM running (2 GB Ubuntu guest: 250 s, an ELF core) and leaves the
snapshot unless `--delete-snapshot`. See vmware-debug-forensics.

## Traps that cost time

- **`checkToolsState` is not readiness.** It said `running` while the VM sat in
  its firmware menu. `wait-tools` waits until a guest operation succeeds.
- **Errors come on stdout** as `Error: ...` with exit status -1 (255). vmctl
  turns them into messages and exit codes; a hung call is abandoned after
  `--call-timeout` seconds (default 300).
- **Start synchronously.** A detached `vmrun start` has made the VMX process
  exit during power-on ("VMX idle exit"). `vmctl.py start` waits.
- **`stop` is soft by default**, which needs Tools; `--hard` pulls the plug.
- **Host networking is not needed** for any of this; see vmware-networking.

Files in this skill

  • SKILL.md7.4 KB
  • reference.md3.6 KB
  • vmctl.py45.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.