Here’s a cheat sheet for some common vim-cmd vmsvc
commands in VMware ESXi:
List All VMs
vim-cmd vmsvc/getallvms
Get VM Configuration:
vim-cmd vmsvc/get.config <vmid>
Power On:
vim-cmd vmsvc/power.on<vmid>
Power Off:
vim-cmd vmsvc/power.off <vmid>
Reset:
vim-cmd vmsvc/power.reset <vmid>
Suspend:
vim-cmd vmsvc/power.suspend <vmid>
Snapshot Operations:
Create Snapshot:
vim-cmd vmsvc/snapshot.create <vmid> <snapshot_name> <description> 0 0
List Snapshots:
vim-cmd vmsvc/snapshot.get <vmid>
Reconfigure VM:
vim-cmd vmsvc/reload <vmid>
Guest Operations:
Run Program in Guest:
vim-cmd vmsvc/runProgramInGuest <vmid> /bin/vim-cmd <args>
Copy File to Guest:
vim-cmd vmsvc/fileMgr/putFileInGuest <vmid> <local_file> <remote_file>
Register VM:
vim-cmd solo/registervm /vmfs/volumes/<datastore>/<vm_directory>/<vmx_file>
Unregister VM:
vim-cmd vmsvc/unregister <vmid>
Remember to replace placeholders like <vmid>, <snapshot_name>, <description>, <local_file>, <remote_file>, <datastore>, <vm_directory>, and <vmx_file> with the actual values relevant to your environment.