-1

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.

6
  • To whoever downvoted this question-- mind sharing why? Apr 1, 2013 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, 2013 at 23:53
  • HV Backup actually does work on Windows 8.
    – Ramhound
    Apr 2, 2013 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. Apr 3, 2013 at 20:18
  • @Nicholas - The website was recently updated to reflect the fact WIndows 8 is not supported.
    – Ramhound
    Apr 3, 2013 at 20:25

3 Answers 3

1

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?

4
  • 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. Apr 2, 2013 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. Apr 2, 2013 at 2:45
  • Also, there is no such thing as "Windows Backup" in Windows 8. Are you thinking of "File History" ? Apr 4, 2013 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. Apr 4, 2013 at 3:13
0

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 = "[email protected]"
    $EmailTo = "[email protected]" 
    $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
0

I know this is an old question. I found it when searching for a solution to how to back up a hyper-v machine running on Windows 10. I believe the situation is the same in Windows 10 as it was with Windows 8. So hopefully the following will be useful to anyone else facing this problem.

The bottom line is that without using third party tools you cannot backup a hyper-v machine running on Windows 8/10. The wbadmin command that allows you to backup hyper-v machines on Windows server doesn't support backups of hyper-v machines on Windows 8/10.

However, whilst you can't backup, you can export. An export is almost as good as a backup, possibly the most significant difference is that the virtual machine won't know that it has been "backed up", so for example sql server won't know that a backup has been run which may have implications for when logs are truncated.

You can either use the Hyper-V manager GUI to do the export or if you want to do it from the command line (which you probably will if you want it run by the task scheduler) then the powershell cmdlet is:

Export-VM -Name 'VM-Name' -PATH 'C:\Export-Path'

if you want to run this from a .cmd/.bat file then it becomes:

powershell -NonInteractive -Command "Export-VM -Name 'VM-Name' -PATH 'C:\Export-Path'"

Be aware that if you are exporting to a network share then the COMPUTER running Hyper-V will need to be granted access to the network share.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .