Selecting clusters and hosts with a text-based menu

Thomas Franke's picture

Perhaps you know the PowerCLI command Connect-VIServer –Menu, which offers a text-based menu to choose a vCenter server or ESXi host to connect to. That is very handy if you run scripts on various targets, because you don’t have to hardcode hostnames and modify your scripts on each execution.

When I start a script, I often want to run it against a single cluster. Wouldn’t it be great to choose the cluster from a menu like the one above while the script is running instead of altering the script every time? The same applies to ESXi hosts, right? I wrote two scripts to show how this can be done.

<The full post is only available in German>