1

Here's a scenario that occurs quite frequently.

Before installing system updates I create a snapshot of a virtual machine in case something goes wrong. After the update is done and there are no problems, I want to remove the snapshot, as it would just be taking up space otherwise.

This means I need to turn the machine off (either completely, or save it). No issues there.

My gripe is that after saving the machine, I need to wait for the merge to complete (and depending on how many updates there were, this can take some time) and then manually bring the machine back up. I know Windows Server 2012 can perform merges when a machine is running, but we're using Windows Server 2008 R2.

Is there any way to have Hyper-V automate this process? I mean - bring the virtual machine up after merging, so I don't need to sit and wait around?

3

Of course there is. Using PowerShell you can stop the vm, start the merge, wait for it to compete, then start the vm.


Update: I thought that running a merge was asynchronous when run from PowerShell, but it appears to be synchronous. So a script would look like this:

$vm = Get-VM theNameOfYourVm
$vm | Shutdown-VM
$vm | Get-VMCheckpoint | Merge-VMCheckpoint
$vm | Start-VM
  • Any chance you have such a script lying around? The "wait for it [merge] to complete" sounds like the biggest hurdle... – Shaamaan Jul 25 '13 at 11:47
  • Get-VMCheckpoint is part of Windows Server 2012 HyperV commands, and isn't available on 2008 R2. Get-VM is also part of that (albeit an implementation can be downloaded from pshyperv.codeplex.com Needless to say, the script isn't needed on Windows 2012 (as merging can be performed on running machines), and just plainly won't work on 2008 R2. – Shaamaan Jul 26 '13 at 6:40
  • PowerShell is available in SCVMM. – longneck Jul 26 '13 at 12:08
  • Ouch. :/ We don't have SCVMM. :< So... I take it without SCVMM or Server 2012 this isn't possible? – Shaamaan Jul 26 '13 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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