vicfg-hostops - perform host-related operations.
vicfg-hostops [<conn_options>] [--action [suspend|poweroff] | --cluster | --datacenter | --force | --operation [enter | exit | shutdown | reboot | info] ]
vicfg-hostops provides an interface for performing operations on ESX/ESXi hosts.
enter maintenance mode
exit maintenance mode
shutdown host
reboot host
The command also displays host related information.
Action to perform on powered on virtual machines (suspend | poweroff) when hosts enter maintenance mode or are rebooted. Default is suspend.
Specify this option to shut down all hosts in a cluster.
Specifies the target server and authentication information if required. Run vicfg-hostops --help
for a list of all connection options.
Specify this option to shut down all hosts in a datacenter.
Use --force
to force the shutdown of all hosts, even those that are not in maintenance mode.
If you do not specify --force
, only hosts that are in maintenance mode are shut down.
Prints a help message for each command-specific and each connection option.
Calling the script with no arguments or with --help
has the same effect.
Required. Operation to perform. Specify
enter
to enter maintenance mode.
exit
to exit maintenance mode.
shutdown
to shut down one or more hosts. By default, hosts must be in maintenance more. Use --force
to
override that default.
reboot
to reboot one or more hosts. By default, hosts must be in maintenance more. Use --force
to
override that default.
info
to display information about one or more hosts
When you run a vSphere CLI command with the --server
option pointing to a vCenter Server system, use --vihost
to specify the ESX/ESXi
host to run the command against.
The following examples assume you are specifying connection options, either
explicitly or, for example, by specifying the server, user name, and password.
Run vicfg-hostops --help
for a list of common options including connection options.
Put the host into maintenance mode:
vicfg-hostops <connection_options> -o enter
Instruct the host to exit maintenance mode:
vicfg-hostops <connection_options> -o exit
Put the host in maintenance mode and power off all powered on virtual machines:
vicfg-hostops <connection_options> -o enter -a poweroff
Put all hosts in the specified datacenter in maintenance mode, and suspend virtual machines that are powered on on those hosts:
vicfg-hostops --server <VC server name> --username <user name> --password <password> -o enter -d <datacenter name> -h <esx_host_name> -a suspend
Shut down all hosts in a cluster. If the hosts are not in maintenance mode, power off all virtual machines and put the hosts into maintenance mode:
vicfg-hostops --server <VC server name> --username <user name> --password <password> -o shutdown -c <cluster_name> -h <esx_host_name> --force
Reboot the host(s)
in the datacenter that belong to the specified cluster. If
hosts are not in maintenance mode, wait until they are:
vicfg-hostops --server <VC_server-name> --username <user name> --password <password> --operation reboot -d <datacenter_name> -c <cluster_name> --vihost <esx_host_name> -f
Display information about a specified host:
vicfg-hostops --server <esx_host> --username <user name> --password <password> --operation info