1、连接到ESXI主机
$ServerIP="192.168.251.54"
$Username="root"
$Password="MyPassword"
$Server=Connect-VIServer -Server $ServerIP -Protocol https -User $Username -Password $Password
2 异步启动虚拟机
执行如下脚本
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 启动虚拟机中的APP
4 关闭连接
Disconnect-VIServer -Server * -Force