【原创】使用PowerCli脚本启动vCenter中的虚拟机

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

没有好办法。
https://docs.vmware.com/cn/VMware-Tools/12.2.0/com.vmware.vsphere.vmwaretools.doc/GUID-615CAD19-C769-4774-A161-3F2E97344E68.html

4 关闭连接

Disconnect-VIServer -Server * -Force

猜你喜欢

转载自blog.csdn.net/u013667796/article/details/132283640