Wait-VMPowerState changes PowerState of VMware VM and waits

When scripting an action on a VMware VM where the VM needs to be shutdown before making changes this function will shutdown or start the VM before proceeding to the next step.  Mandatory arguments are -VMName and -Operation (either up or down).  Wait-VMPowerState has been tested with PowerShell v2.0 and v3.0 CTP, and PowerCLI v5.0.