Starting and stopping VMs is not that difficult, so why script it? Well… don’t want to be clicking on a bunch of VMs trying to skip the ones that should be left powered off! Did it ever happened that you accidentally dropped shift and had to re-do it? YES!!!
The base command is simple:
get-vm -name myvm | Start-VM #Start
get-vm -name myvm | Stop-VM #Stop
That said, we can do lots of funny things with it using wildcards, like start all VMs that start with office…
get-vm -name office* | Start-VM
or all VMs in a cluster
get-cluster cluster1 | get-vm | Start-VM
or all VMs in a single host
get-vmhost myESX | get-vm | Start-VM
As you can see, the world is your oyster!
Stopping follows exactly the same principle, just replace Start-VM with Stop-VM