vm_guest_exec
Execute a command inside a VM guest OS using VMware Tools, with output retrieval via file redirection.
Instructions
[WRITE] Execute a command inside a VM via VMware Tools.
Requires VMware Tools running in the guest OS. Returns exit_code, stdout, stderr, and timed_out flag.
Note: VMware Guest Ops API does not capture stdout/stderr directly. To capture output, redirect to a file and use vm_guest_download: command="/bin/bash", arguments="-c 'ls -la /tmp > /tmp/output.txt'" Then download /tmp/output.txt.
Args: vm_name: Target VM name. command: Full path to program (e.g. "/bin/bash", "C:\Windows\System32\cmd.exe"). arguments: Command arguments (e.g. "-c 'whoami'"). username: Guest OS username (default "root"). password: Guest OS password. working_directory: Working directory inside guest (optional). target: Optional vCenter/ESXi target name from config.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vm_name | Yes | ||
| command | Yes | ||
| arguments | No | ||
| username | No | root | |
| password | No | ||
| working_directory | No | ||
| target | No |