Version 2

    This script allows you to perform the following host operations enter_maintenance_mode,exit_maintenance_mode and reboot across set of ESX(i) hosts being managed by vCenter.



    vCenter 2.5 or vCenter 4.0

    ESX(i) hosts 3.5 or 4.0

    vCLI 4.0 or vMA 4.0



    • enter_maintenance_mode

    • exit_maintenance_mode

    • reboot


    Sample Execution:


    Create a file with list of hosts you want to perform certain operation on

    [vi-admin@scofield ]$ cat hosts



    Enter maintenance mode (will vMotion off any powered on/off VMs to other available host if DRS is enabled with additional hosts):

    [vi-admin@scofield ]$ ./ --server --hostfile hosts --operation ent_maint
    Entering maintenance mode for host: "" and evacauating any VMs if host is part of DRS Cluster ...
            Successfully entered maintenance mode for host: ""!



    Exit maintenance mode:

    [vi-admin@scofield ]$ ./ --server --hostfile hosts --operation exi_maint
    Exiting maintenance mode for host: "" ...
            Successfully exited maintenance mode for host: ""!



    [vi-admin@scofield ~]$ ./ --hostfile list --operation reboot
    Rebooting host: "" ...
            Successfully rebooted host: ""!