VMware PowerCLI is a set of 200+ PowerShell cmdlets designed for Mangement and Automation of vCenter operations.  PowerCLI reaches almost every point of the VMware Infrastructure from a management and configuration standpoint and is a easy to use Powershell interface to the VMware APIs.

PowerCLI operations can be executed from the PowerCLI console or as scripts, custom applications (Java, .Net, Perl, etc...) which allows them to be flexible.  This flexibility allows administrators to automate tedious tasks such as patching, provisioning, etc... while it also assures consistency and reduces human error in scaled rollouts.  PowerCLI can also be used for reporting, monitoring and remediation jobs as well.  PowerCLI allows developers object based access to the VMware APIs which reduces application complexity and allows for various forms of user interaction such as web based apps, plugins, console apps and mobile apps via PowerShell remoting.

In this example I will demonstrate how to patch an ESX(i) host(s) all at once and monitor the results.  Keep in mind, you can always add the -whatif flag to statements to simulate a job before actually executing.  From this, I hope to demonstrate how to connect, get hosts managed by vCenter, configure a task and monitor the progress and output of that task.
<ol>
	<li><strong>Create your ps1 file or open up an interactive PowerCLI session.</strong></li><br />
	<li><strong>Connect to vCenter</strong>:  connect-viserver &lt;vcenteraddress&gt; -user &lt;user&gt; -password &lt;password&gt;</li><br />
	<li><strong>Change the directory to the location of your patch files</strong>.  Note: Patch file must have a metadata.zip and be accessible from all hosts.  You can map a PSDrive with the following command.  New-PSDrive -Name &lt;name&gt; -PSProvider VIMDataStore -Root '/' -Location Get-DataStore &lt;DataStore Name&gt;</li><br />
	<li><strong>(Optional) If the patch files are on your local machine you can copy them to this location using the copy command:</strong> copy-datastoreitem '&lt;source&gt;' . -recursive</li><br />
	<li><strong>Get the HOST list and set them into maintenance mode (use the evacuate option to migrate VMs)</strong>: get-vmhost | set-VMHost -state  Maintenance</li><br />
	<li><strong>Set a variable to hold the tasks to execute:</strong>  $tasks = @()</li><br />
	<li><strong>Populate the tasks array with the patch commands:</strong>  get-vmhost | foreach { $tasks = &lt;patch location of metadata.zip file&gt; -VMHost $_ -RunAsync}</li><br />
	<li><strong>You should now see the tasks executing in the vSphere Client.  </strong></li><br />
	<li><strong>To monitor these tasks in the PowerCLI console type</strong>: wait-task $tasks</li><br />
	<li><strong>Once the operation is complete, set the hosts out of maintenance mode and reboot if instructed to do so by the result of the patching operation:  get-vmhost</strong> | set-VMHost -state  Connected</li><br />
</ol>
To evacuate the VMs and do a host at a time you can remove the -RunAsync parameter and add the -Evacuate parameter to the maintenance mode setting to evacuate the VMs to another host prior to entering maintenance mode. 

Example: get-vmhost | foreach {

set-VMHost -state  Maintenance -Evacuate

&lt;upgrade script&gt;

}

Questions, please use the comments below.