1. Connect to the ESXI host
$ServerIP="192.168.251.54"
$Username="root"
$Password="MyPassword"
$Server=Connect-VIServer -Server $ServerIP -Protocol https -User $Username -Password $Password
2 Start the virtual machine asynchronously
Execute the following script
VMware.VimAutomation.Core\Start-VM -RunAsync -Server 192.168.251.54 -VM 012_CentOS8_DHCP
VMware.VimAutomation.Core\Start-VM -RunAsync -Server 192.168.251.54 -VM 013_W2022_信息发布系统
VMware.VimAutomation.Core\Start-VM -RunAsync -Server 192.168.251.54 -VM 078_W10_金忱
VMware.VimAutomation.Core\Start-VM -RunAsync -Server 192.168.251.54 -VM 079_W10_宜宾远程办公
3 Start the APP in the virtual machine
There is no good way.
https://docs.vmware.com/cn/VMware-Tools/12.2.0/com.vmware.vsphere.vmwaretools.doc/GUID-615CAD19-C769-4774-A161-3F2E97344E68.html
4 Close the connection
Disconnect-VIServer -Server * -Force