Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running at least one VM using Hyper-V in Windows 8 Pro, and I'd like to back it up while it's still running.

Windows Server 2012 handles this great with the built-in "Windows Server Backup" engine.

But I cannot find a way to accomplish this on Windows 8.

I found HyperVBackup, and open source app to backup HyperV, but it doesn't work on Windows 8.

share|improve this question

migrated from serverfault.com Apr 2 '13 at 8:43

This question came from our site for system and network administrators.

    
To whoever downvoted this question-- mind sharing why? –  Nicholas Apr 1 '13 at 23:08
    
If you shut down the VM, you can copy the VHD elsewhere as a really simple backup. To restore it you would need to grab the VHD and set it up again. But attaching a VHD is pretty simple. If you are using Windows Server in the VM, you can backup from within the VM itself. –  MikeAWood Apr 1 '13 at 23:53
    
HV Backup actually does work on Windows 8. –  Ramhound Apr 2 '13 at 11:02
    
@Ramhound - have you personally gotten it to work with Win8? I haven't. Debugging the code shows Windows is missing the expected VSS writer. –  Nicholas Apr 3 '13 at 20:18
    
@Nicholas - The website was recently updated to reflect the fact WIndows 8 is not supported. –  Ramhound Apr 3 '13 at 20:25

2 Answers 2

Windows Server Backup, System Restore, Previous Versions, Windows Backup / Windows 7 File Recovery and most other backup technologies on windows use a service called Volume Shadow Copy (VSS) to perform backups.

And backup software using VSS will be able to snapshot then backup virtual machines just fine without shutting them off.

Why not use Windows Backup (included in Windows 8 Pro) to perform backups?

share|improve this answer
    
The "Hyper-V VSS Writer" doesn't seem to be installed on Windows 8, so I'm not sure this will work. Windows 8 does have "Windows 7 File Recovery" (which lets you do a system image)-- but I'm not sure if that'll work with Hyper-V. Guess it's worth a shot. –  Nicholas Apr 2 '13 at 2:26
    
True but neither does Windows Server 2012. It does have the Hyper-V Volume Shadow Copy Requester service which "Coordinates the communicates that are required to use Volume Shadow Copy Service to back up applications and data on this virtual machine from the operating system on the physical computer." Sounds like the same thing. –  Nick Whaley Apr 2 '13 at 2:45
    
Also, there is no such thing as "Windows Backup" in Windows 8. Are you thinking of "File History" ? –  Nicholas Apr 4 '13 at 3:05
    
@Nicholas "File History" is using VSS to snapshot the disks but the shadow copies are stored on the same disk (hence NOT a backup solution). Windows Backup is labeled "Windows 7 File Recovery" in Windows 8. –  Nick Whaley Apr 4 '13 at 3:13

This is the PowerShell script I use to backup my Client VM's running on Windows 8 although I don't do them live. PowerShell is not my strongest suite and it makes some assumptions but I hope it's useful to get someone else started quickly

function SendMail([string]$Subject, [string]$Body)
{
    #SMTP Variables

    $EmailFrom = "from@example.com"
    $EmailTo = "to@example.com" 
    $SMTPServer = "smtp.gmail.com" 
    $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 
    $SMTPClient.EnableSsl = $true 
    $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("Username", "Password"); 

    $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

}

function init()
{
    # Delete existing shares

    #Net Use * /delete /y

    $guid = [guid]::NewGuid()
    $vms = Get-VM        
}

try
{
    $guid = [guid]::NewGuid()
    $vms = Get-VM  

    $pass = cat C:\HVBackup\securestring.txt | ConvertTo-SecureString
    $mycred = New-Object -typename System.Management.Automation.PSCredential -ArgumentList "Username",$pass

    New-PSDrive -Name V -PSProvider FileSystem -Root "\\NAS\Hyper-V" -Persist -Credential $mycred

    $Subject = "Notification from Virtual Machine Backup" 
    $Body = "Starting Virtual Machine Backup." 

    SendMail($Subject,$Body)

    foreach ($vm in $vms)
    {
        if($vm.State -eq "Running") { Stop-VM $vm.VMName -Save -Force }
    }

    #Stop-VM * -Save -Force

    # Delete all the files older than 7 days

    $TargetFolder = “V:\Backups”
    foreach ($i in Get-ChildItem $TargetFolder -recurse)
    {
        if ($i.CreationTime -lt ($(Get-Date).AddDays(-7)))
        {
            Remove-Item $File.FullName -force
        }
    }

    # Export the virtual machines to directory

    Export-VM * V:\Backups\$guid\

    $Subject = "Notification from Virtual Machine Backup" 
    $Body = "Finished Virtual Machine Backup." 

    SendMail($Subject,$Body)

    exit 0

}
catch [System.Exception]
{
    $Subject = "Notification from Virtual Machine Backup" 
    $Body = "There has been an error whilst running virtual machine backup." + $_.Exception.Message

    Write-Host($_.Exception.Message)

    SendMail($Subject,$Body)

    exit 1
}
finally
{

    Remove-PSDrive V

    $vms = Get-VM

    foreach ($vm in $vms)
    {
        if($vm.State -eq "Saved") { Start-VM $vm.VMName }
    }

    # Start the domain controller virtual machine

    #Start-VM dc.applicita.local
}

Here's the script that I use to generate the password file.

read-host -assecurestring | ConvertFrom-SecureString | out-file C:\HVBackup\securestring.txt
share|improve this answer

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.