How to Back Up Hyper-V Virtual Machines on Windows Server 2012 R2

Backing up Hyper-V virtual machines is a critical operational responsibility. A comprehensive Hyper-V backup strategy must produce consistent, recoverable backups without disrupting running VMs. Windows Server 2012 R2 provides multiple backup mechanisms: host-level VSS-based backup (captures the entire VM state from the host), guest-level backup (runs backup software inside the VM), and Hyper-V Replica (real-time replication for DR). This guide focuses on host-level backup using Windows Server Backup, PowerShell, and integration with the Hyper-V VSS writer for application-consistent backups.

Backup Concepts for Hyper-V

There are two types of VM-consistent backups:

  • Crash-consistent: A snapshot of the VM’s disk state at a point in time, as if power was suddenly removed. The VM can recover from this state but may require disk consistency checks or transaction log rollback
  • Application-consistent (VSS-consistent): The VM’s applications (SQL Server, Exchange, file system) are quiesced via VSS before the backup. Data is in a logically consistent state and applications can resume cleanly. Requires Integration Services VSS (Volume Shadow Copy) component running in the guest

Prerequisites

  • Windows Server 2012 R2 Hyper-V host
  • Integration Services running in all VMs (particularly the Backup/VSS component)
  • Windows Server Backup feature installed on the host
  • Sufficient backup storage (separate disk or network share recommended)

Step 1 — Install Windows Server Backup

Install-WindowsFeature -Name Windows-Server-Backup -IncludeManagementTools

Step 2 — Verify VSS Integration Service is Enabled

Get-VM | ForEach-Object {
    $VM = $_.Name
    $VSS = Get-VMIntegrationService -VMName $VM -Name "Backup (Volume Shadow Copy)"
    [PSCustomObject]@{
        VM = $VM
        VSSEnabled = $VSS.Enabled
        VSSStatus = $VSS.PrimaryStatusDescription
    }
} | Format-Table -AutoSize

Enable VSS for any VMs that have it disabled:

Get-VM | ForEach-Object {
    Enable-VMIntegrationService -VMName $_.Name -Name "Backup (Volume Shadow Copy)"
}

Step 3 — Configure Windows Server Backup for Hyper-V

Use Windows Server Backup to back up VMs from the host. Create a backup policy:

$Policy = New-WBPolicy
$BackupTarget = New-WBBackupTarget -VolumePath "E:"
Add-WBBackupTarget -Policy $Policy -Target $BackupTarget

# Add the Hyper-V component (backs up all VMs):
Add-WBHyperVComponent -Policy $Policy

# Configure VSS settings (ApplicationConsistentBackupType for app-consistent, CopyOnlyBackupType for crash-consistent):
Set-WBVssBackupOption -Policy $Policy -VssBackupOption VssCopyBackup

# Set backup schedule (e.g., 11 PM daily):
Set-WBSchedule -Policy $Policy -Schedule 23:00

# Apply the policy:
Set-WBPolicy -Policy $Policy

To back up individual VMs rather than all VMs, specify them in the policy:

$VM1 = New-WBHyperVComponent -VMName "ProductionDB01"
$VM2 = New-WBHyperVComponent -VMName "WebServer01"
Add-WBHyperVComponent -Policy $Policy -Component $VM1
Add-WBHyperVComponent -Policy $Policy -Component $VM2

Step 4 — Run an Ad-Hoc Backup

Perform an immediate backup outside the schedule:

Start-WBBackup -Policy $Policy

Monitor backup progress:

Get-WBJob -Previous 1 | Select-Object JobType, StartTime, EndTime, JobState, ErrorDescription

Step 5 — Export VM as a Backup Method

For a simpler alternative to Windows Server Backup, VM Export captures the complete VM state and is suitable as a backup method when combined with rotation and off-host storage:

$BackupRoot = "E:VM-Backups"
$Date = Get-Date -Format "yyyyMMdd"

Get-VM | ForEach-Object {
    $VMName = $_.Name
    $DestPath = "$BackupRoot$VMName$Date"
    New-Item -ItemType Directory -Path $DestPath -Force | Out-Null
    
    Write-Host "Exporting $VMName..."
    Export-VM -Name $VMName -Path $DestPath
    
    # Verify export:
    $ExportSize = (Get-ChildItem -Path "$DestPath$VMName" -Recurse | Measure-Object -Property Length -Sum).Sum / 1GB
    Write-Host "Exported $VMName: $([math]::Round($ExportSize, 1)) GB"
}

Step 6 — Implement Backup Rotation

Retain only the last N backups to prevent backup storage from filling up:

$BackupRoot = "E:VM-Backups"
$RetainDays = 7

Get-ChildItem -Path $BackupRoot -Directory | ForEach-Object {
    $VMBackupPath = $_.FullName
    Get-ChildItem -Path $VMBackupPath -Directory | Sort-Object Name | Select-Object -SkipLast $RetainDays | ForEach-Object {
        Write-Host "Removing old backup: $($_.FullName)"
        Remove-Item -Path $_.FullName -Recurse -Force
    }
}

Step 7 — Back Up Using Hyper-V VSS Writer Directly

The Hyper-V VSS writer (Hyper-V Replica Service Writer and Microsoft Hyper-V VSS Writer) can be used by any VSS-aware backup software. Verify the writers are available:

vssadmin list writers | findstr /i "Hyper-V"

Expected output includes:

  • Microsoft Hyper-V VSS Writer — backs up VMs at the host level

If the writer shows a failed or error state, restart the relevant services:

Restart-Service -Name "vmms" -Force  # Hyper-V Virtual Machine Management
Restart-Service -Name "vss" -Force   # Volume Shadow Copy

Step 8 — Restore a VM from Windows Server Backup

# List available backup versions:
Get-WBBackupSet | Select-Object BackupTime, VolumeLabel, SnapshotTime

# Start a recovery (interactive):
Start-WBFileRecovery -BackupSet (Get-WBBackupSet | Select-Object -Last 1)

# Recover Hyper-V components:
$BackupSet = Get-WBBackupSet | Select-Object -Last 1
$HVComponents = Get-WBHyperVRecoveryTarget -BackupSet $BackupSet
Start-WBHyperVRecovery -BackupSet $BackupSet -VMInBackup ($HVComponents | Where-Object { $_.VMName -eq "ProductionDB01" }) -RecoveryPath "D:RestoredVMs" -NoRollForward

Step 9 — Verify Backup Integrity

# View recent backup job results:
Get-WBJob -Previous 7 | Select-Object StartTime, EndTime, JobState, ErrorDescription | Format-Table -AutoSize

# Check backup event log:
Get-WinEvent -LogName "Microsoft-Windows-Backup" | Where-Object { $_.LevelDisplayName -ne "Information" } | Select-Object -First 10 TimeCreated, LevelDisplayName, Message

Third-Party Backup Integration

Enterprise environments typically use third-party backup solutions (Veeam, Backup Exec, DPM) that integrate with the Hyper-V VSS writer for more advanced features including:

  • Incremental backups (changed block tracking)
  • Deduplication and compression
  • Application-aware processing (SQL, Exchange truncation)
  • Instant VM recovery (boot from backup)
  • Off-host backup processing

These solutions use the same Hyper-V VSS writer infrastructure and Integration Services backup component, so ensuring IS is functional and up-to-date is equally important for third-party solutions.

Summary

Backing up Hyper-V virtual machines on Windows Server 2012 R2 requires understanding the distinction between crash-consistent and application-consistent backups, ensuring VSS Integration Services are enabled and functional in all VMs, and implementing a backup rotation strategy. Windows Server Backup provides a built-in, no-cost solution for host-level VM backup with VSS application consistency. For production environments with demanding RPO/RTO requirements, third-party backup solutions leveraging the Hyper-V VSS writer provide advanced capabilities like incremental backups and instant recovery. Regardless of the tool used, regularly testing backup restore procedures is as important as the backup process itself.