The vim-cmd command could be a very good CLI when you need to start a VM, for example, the vCSA:
[root@esxi-prod-1:~] vim-cmd
Commands available under /:
hbrsvc/ internalsvc/ solo/ vmsvc/
hostsvc/ proxysvc/ vimsvc/ help
For example, with the vmsvc namespace, you can manage the power status of a VM:
[root@esxi-prod-1:~] vim-cmd vmsvc/
Commands available under vmsvc/:
acquiremksticket get.snapshotinfo
acquireticket get.spaceNeededForConsolidation
createdummyvm get.summary
destroy get.tasklist
device.connection getallvms
device.connusbdev gethostconstraints
device.ctlradd message
device.ctlrremove power.getstate
device.disconnusbdev power.hibernate
device.diskadd power.off
device.diskaddexisting power.on
…
The first step is to list all VMs because we need the VM identificator (VMID) to power it on:
[root@esxi-prod-1:~] vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
19 Windows-Prod-1 [C2] Windows-Prod-1/Windows-Prod-1.vmx windows8Server64Guest vmx-14
20 Windows-Prod-4 [C1] Windows-Prod-4/Windows-Prod-4.vmx windows8Server64Guest vmx-14
21 Windows-2019-Test-1 [Shared Storage] Windows-2019-Test-1/Windows-2019-Test-1.vmx windows9Server64Guest vmx-14
When we know the correct VMID, we can power on the VM:
[root@esxi1:~] vim-cmd vmsvc/power.on 19
With vim-cmd, you can try a lot of further commands. In the following example, the following command is used to get network information for VM 19:
[root@esxi-prod-1:~] vim-cmd vmsvc/get.network 19
Networks:
(vim.Network.Summary) {
network = 'vim.Network:HaNetwork-VM Network',
name = "VM Network",
accessible = true,
ipPoolName = "",
ipPoolId = <unset>
}