Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Hyper-V VM which needs to be restored to its previous snapshot daily. I would like to automate this process. I’ve heard of the Powershell Management Library for Hyper-V on Codeplex, but I am not sure it is what I am looking for exactly. The scripts seem to be runnable from the Host, the not VM. This is making sense, but I would prefer the VM itself to schedule, and restore the snapshot. Is it possible?

In brief, I would like to know if it is possible for a VM (not the Host) to restore a snapshot.

Thanks.

share|improve this question
    
out of curiosity why would you want the guest to tell the host to restore itself and not rnu it right on the host? The host seems to me to be the place to run this not a guest. –  Jim B Jul 26 '09 at 17:34
    
The machine runs tests all day long. When the process is completed, I want the machine to restore to the latest snapshot and re-start the test suite. –  Martin Jul 26 '09 at 21:05
    
so wouldn't it be safer to have the host see if the test was complete (maybe by polling the event log?) then restore then snap? –  Jim B Jul 26 '09 at 23:02
add comment

1 Answer

Many of the commands in that Powershell library have a -server parameter. Provided that the guest VM has the proper access to the Host (through the firewall, WMI, etc), you could do something like:

$server = myhyperv.mydomain.com
$guest = "My Guest Machine"
choose-vmsnapshot $guest $server | apply-vmsnapshot
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.