Hi all:
I want to shutdown the host and all the VMs on the pointed host in the vcenter though the perl script(as attachment):
shutdownESXi_vcenter.pl --server vcenter_IP --username vcenter_username --password vcenter_password --host "needToShutdownhost_IP"
The perl script run successfully when the host VM Startup/Shutdown settings are enabled, the host and VMs can be shutdown gracefully
but it fail if the host VM Startup/Shutdown settings are disabled (when the Cluster in the HA, the host VM Startup/Shutdown settings are disabled by forcely)
I hope the VMs can be shut down by VM tools whenever the host VM Startup/Shutdown settings are enable or disable, how can I modify the script?
for example: shut down VMs with VMTools running on an HA host,when host VM Startup/Shutdown settings are disable.
I find the script “vmcontrol.pl” under “C:\Program Files (x86)\VMware\VMware vSphere CLI\Perl\apps\vm”, it can used to shut down the VMs
But the VMs’ name is needed (I want to find and shut down the VMs on the host automatically, not input the vmware name):
Just as below:
perl vmcontrol.pl --username root --password esxadmin --operation shutdown --vmname VM3
I also find the script “vicfg-hostops.pl” under “C:\Program Files (x86)\VMware\VMware vSphere CLI\Perl\bin”
I run the command just as below,but only the host can be shutdown gracefully, not include VMs
vicfg-hostops.pl -o shutdown -f -a poweroff --server <your server> --username <username> --password <password>
The “vicfg-hostops.pl” can also poweroff the VMs in the same cluster, is there some option to shut down the VMs in the appointed host?
vicfg-hostops --server <VC server name> --username <user name> --password <password> -o shutdown -c <cluster_name> -h <esx_host_name> --force
Thread moved to vSphere Command-Line Interface
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
