Oct 5, 2009 at 1:26 PM
Edited Oct 5, 2009 at 1:27 PM
@Jamesone: I am not sure if the answer you gave it is what the question is looking for.
The challenge is the fact that the SUSPEND-VM command is already released but in the background the HyperV server is still busy suspending the machine. So the script should wait untill the GET-VM states "SUSPENDED" instead of "SAVING"
I also did some research but i could not figure it out... can you/anyone help me out?
# suspend VM
# begin loop
if(get-vm pr-vm-07 | select-string -pattern "Saving")
# Still saving
write-host "Still saving, script sleeping"
if(get-vm pr-vm-07 | select-string -pattern "Suspended")
# Backup machine
write-host "Suspending finished and ready for backup"