Shutdown all powered on guest machines in the datacenter using PowerCli

I recently had a request regarding a quick method to shutdown /power off / power on all  guest virtual machines in the datacenter except the virtual vCenter.
   
A simple process using powercli is shown below,
 
First specify all the powered on guests using a variable, then exclude the name of the virtual vCenter

e.g Where virtual vCenter name = vCenter01

 $vms = get-vm | where {$_.PowerState -eq "poweredon"} | Where-Object {"vCenter01" -notcontains $_.Name}

 Now the guests to be controlled have been identified  the following commands can be used

 get-vm                                       Lists specified guests
 Shutdown-VMGuest $vms        This will gracefully powerdown the machines using VMware Tools service.
 stop-vm $vms                           This will poweroff the guest machines ungracefully (i.e pulling out power)
 start-vm $vms                           This will power on the same set of virtual machines.