A command-line utility in VMware ESXi that provides an interface to interact with the VMware Infrastructure (VI) API, allowing users to manage and automate tasks on ESXi host and its virtual machines (VMs)
Enables SSH services on the ESXi host
vim-cmd hostsvc/enable_ssh
Disable autostart of Virtual Machines
vim-cmd hostsvc/autostartmanager/enable_autostart false
vim-cmd hostsvc/autostartmanager/enable_autostart 0
Displays summary of system information about the ESXi host
vim-cmd hostsvc/hostsummary | grep cpuModel
Displays the list of VMs available on an ESXi host.
vim-cmd vmsvc/getallvms
/bin/sh -c “for vmid in $(vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}'); do vim-cmd vmsvc/power.off $vmid; done"
Remove VM Snapshots
vim-cmd vmsvc/snapshot.removeall
for i in `vim-cmd vmsvc/getallvms| awk '{print$1}'`;do vim-cmd vmsvc/snapshot.removeall $i & done
vim-cmd vmsvc/snapshot.removeall %llu > /dev/null 2>&1
Power off VM
vim-cmd vmsvc/power.off
vim-cmd vmsvc/getallvms | grep -o -E \'^[0-9]+\' | xargs -r -n 1 vim-cmd vmsvc/power.off
/bin/sh -c “for vmid in $(vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}'); do vim-cmd vmsvc/power.off $vmid; done"