Thank you!
For good measure, is there a way to run it per VM also? i.e. give it the VM name somehow?
I tried replacing the forst 2 lines with
$VM = get-view –viewtype VirtualMachine –filter @{“Name”=”VMNAME”}
but that leaves out the canonical name...