Custom my-vmware-cmd management script
Download script: my-vmware-cmd.sh
Supported On: ESX 3.5+ and ESXi
Please find more details located at: http://communities.vmware.com/docs/DOC-9061
This is a custom management script to help administer large virtual machine environments. This script is used to run administrative commands across a large set of virtual machines specified in a file. In particular, this tool complements the developed linked clones. scripts. For example, to save unique attributes (Active Directory personalities, etc.) for each linked VM, a final snapshot is executed on all linked VMs after joining each to the domain. After a specified duration, this script is then used to revert each VM back to a clean state. The same may be applied on other (non-linked) virtual machines currently residing on the ESX(i) server(s).
To get list of options, just execute the script:
[root@himalaya scripts]# ./my-vmware-cmd.sh
Usage: Local execution- my-vmware-cmd.sh [operation] [vm_input_file] <optional_arguments> Remote execution- my-vmware-cmd.sh remote [ESX_ESXI_IP_ADDRESS] [operation] [vm_input_file] <optional_arguments> Operations: start [vm_input_file] -- Start all VMs in the input file stop [vm_input_file] -- Stop all VMs in the input file suspend [vm_input_file] -- Suspend all VMs in the input file resume [vm_input_file] -- Resume all suspended VMs in the input file reset [vm_input_file] -- Hard reset all VMs in the input file shutdown [vm_input_file] -- Shutdown all VMs in the input file (VMware Tools required) reboot [vm_input_file] -- Reboot all VMs in the input file (VMware Tools required) snap [vm_input_file] -- Create administrative pristine snapshot of all VMs in the input file revert [vm_input_file] -- Revert all VMs in the input file back to pristine state purge [vm_input_file] -- Removes from local inventory and purges all VMs in the input file mac [vm_input_file] [generic|nixdhcp] [NETWORK (172.30.0)] [HOST_COUNT_START (200)] <NIC_#> default=0 -- Extracts MAC addresses and generates either a generic file or one compatible with *nix dhcpd ( e.g. my-vmware-cmd.sh mac [vm_input_file] generic ) ( e.g. my-vmware-cmd.sh mac [vm_input_file] nixdhcp 172.30.0 200 ) vnic [vm_input_file] <NIC_#> default=0 -- Change vNic portgroup for all VMs in the input file ( e.g. my-vmware-cmd.sh vnic [vm_input_file] 3 )