VMware PowerCLI is an extremely powerful tool, and there are countless blogs, forums, and conversations in VMware communities that provide complex scripts and one-liners to better serve and manage your infrastructure. In this recipe, we'll discuss a few samples and syntaxes of some very powerful one-liners that are useful when managing as small as a single VMware vCenter with three ESXi hosts or as complex as thousands of vCenter systems with hundreds of thousands of hosts.
This recipe is divided into two sections: one-line scripts and multiline scripts. One-line scripts can be entered in the PowerCLI window itself. For multiline scripts, it is a good idea to write the script in the PowerShell ISE, then run it in the PowerCLI window.