Windows 2016 Server Backup to Test against Third Party Backup Applications

Having trouble with your Third party Backup application? If you have Windows 2016 you need look no further then your own Server OS.  This will be especially necessary for the vendor of your hardware if the OS is an OEM title. The goal is to just ensure the OS and VSS writers are not the cause of backup failure. Once that is established, You can likely take the issue to your Backup Application support. But now you have proof the core Backup services are not failing. Windows is not often the underlying problem.

Below I have laid out how to Backup your Virtual Machines using windows backup. You can Use the Graphical interface to setup a full backup. I really focused on just the basic VM backup as this is very typical of what is failing about a third party backup.

Setup the Backup

  1. Install-WindowsFeature -Name Windows-Server-Backup -IncludeAllSubFeature –Verbose
  2. wbadmin.msc
  3.  Under Optimize Backup Performance- three choices
    • Normal Backup
    • Faster Speed
    • Custom
  4. Choose “custom” to Backup Virtual Machines. Then Next
  5. Select Items for Backup – Choose Add Items- then Select your Virtual Machines
  6. Click Ok
  7. Now looking at “select Items for Backup”. and choose Advanced Settings
  8. Add Any Exclusions and also choose if you want a Full or Copy Backup- Choose full to backup applications in the VM. Choose Copy Backup if you have another application backing up applications in the VM.
  9. choose Ok
  10. Choose Next from the Select Items for Backup window
  11. In the Specify Backup Time, select Once a Day- and the time of day. or More than Once a Day and the time, then next.
  12. In the Specify Destination Page
    1. Chose Backup to a hard disk (dedicated)
    2. Backup to a shared Volume
    3. Backup to a Shared network Folder

Basic Backup Choices

If you are testing Windows backup, you may review the Full or Copy backup option. If you choose a full Backup, windows will truncate the logs after backup completes. If you use a copy backup, the logs are not truncated, allowing your third party backup to continue with incremental backups. For testing, if the third party backup is not working, I would recommend doing a full Backup with windows backup. First this is good if your Third Party application is not working 100%.  This is also good so you can clear out Shadow Copies and Snapshots. Then you may try your Backup Application again. After Successful Full Backup run Diskshadow then Delete shadows all.

Successful completion of this backup also validates your backup sub-system is essentially working correctly. Upon success, you can go back and see how the third party backup fails in comparison to Windows backup. Troubleshoot the Third party backup, with the knowledge the underlying VSS is working correctly.

Troubleshooting Steps

To see Windows Backup Power-Shell commands, Run backup of vms manually and find logs check out the commands and log file locations below.

  • Get-Command –Module WindowsServerBackup
  • .\New-WSVMBackup.ps1 -HVHost myhost -backupType Network
  • Applications and Services Logs > Microsoft > Windows > Backup
  • C:\Windows\Logs\WindowsServerBackup
    • For the etl file in the folder above you can run some queries on the file to get a report
    • tracerpt logfile.etl -o logdmp.xml -of XML -lr -summary logdmp.txt -report logrpt.xml (is one example)
    • For more ideas check out- TraceRpt
  • VssDiag is a free tool you can use

Running New-WSVMBackup, you will be prompted for user and password, followed by the selection of the VMS you want to backup. New-WSVMBackup.ps1 is a script available at Github

This script comes along with the Book titled Windows Server 2016 Hyper V Cookbook Second Edition . I have posted it in its entirety at the end of this post. However, I would say to go have a look at the book. It’s a pretty good reference and Very helpful for Windows 2016.

The Best place to find logs is the Event Viewer. In the backup folder, you can get some incite into any failures.  Additional logs located at C:\Windows\Logs\WindowsServerBackup

To conclude, I have given some steps to run windows backup to isolate windows as working and backing up properly. If you find VSS or Backup fails, You can begin your deep dive into windows backup failures which is beyond the scope of this article.

Deep Dive Windows Backup Troubleshooting

I will point you to the tools to being this work. For Server 2012, 2016 and 2019 you can look to the Windows 10 SDK for the tools. They are located here

Tools you can use include:

 

Beyond this, look at the logs and tools above to try to get more specific on what the issue is. I included some articles of the past, such as how to add requester logs and vss api logging. There are a lot of details and ways VSS can break. For example Dcom and registration of writers. I include some of the most common examples of the past. I hope they are helpful.

Past Fixes for problematic VSS or Backup failures

This concludes this article. I want to go much deeper as I have seen alot of backup failure scenarios. I am just out of time. I wanted to be just an way to test your basic windows backup. I hope this helps you beyond that to some degree in your troubleshooting.

New-WSVMBackup.ps1

Below is the script used in this article to manually create the backup with a power-shell one line command. This is publicly available at Github but also part of the Windows Server 2016 Cook Book. So Please give them a read. There are some Example Chapters at GitHub but the book is highly regarded. 

<#
//———————————————————————–
// Copyright (c) {charbelnemnom.com}. All rights reserved.
//———————————————————————–
.SYNOPSIS
Create backup policy for Hyper-V virtual machine(s).
.DESCRIPTION
Create backup policy to backup Hyper-V virtual machine(s) every day at 5p.m.
.NOTES
File Name : New-WSVMBackup.ps1
Author : Charbel Nemnom
Version : 2.0
Date : 12-December-2016
Requires : PowerShell Version 3.0 or above
OS : Windows Server 2012, 2012 R2, 2016 (Full and Server Core)
.LINK
To provide feedback or for further assistance please visit:
https://charbelnemnom.com
.EXAMPLE
./New-WSVMBackup -HVHost -BackupType <Disk, Volume, Network> -WBSchedule “17:00”
This example will set the policy to back up Hyper-V virtual machine(s)
to Disk, Volume or Network Share every day at 5.00 pm.
#>

[CmdletBinding()]
param (
[Parameter(Mandatory=$true, Position=0, HelpMessage = ‘Specify Hyper-V Host’)]
[Alias(‘Host’)]
[String]$HVHost,

[Parameter(Mandatory=$true, HelpMessage = ‘Specify Backup Destination Type’, ParameterSetName = “Enable”)]
[ValidateSet(“Disk”, “Volume”, “Network”)]
[String]$BackupType,

[Parameter(Mandatory=$true, HelpMessage = ‘Specify Backup Schedule’)]
[Alias(‘Schedule’)]
[String]$WBSchedule

)

# Check Windows Server Backup Feature
$WSB = Get-WindowsFeature -Name Windows-Server-Backup
If ($WSB.Installed -eq $false) {
Write-Warning -Message “Windows Server Backup Feature is not installed”
Write-Verbose “Installing Windows Server Backup…” -Verbose
Install-WindowsFeature -Name Windows-Server-Backup -IncludeAllSubFeature -Restart:$false
}

# Check Hyper-V Host
Try {
Get-VMHost -ComputerName $HVHost -ErrorAction Stop
}
Catch
{
Write-Error -Message “Hyper-V Host Name: $HVHost is not reachable”
return
}

# Select one or more VMs to Backup
$VMs = Get-VM -ComputerName $HVHost | Out-GridView -Title “Select one or more VMs to Backup” -PassThru

# Remove Existing Backup Policy
Try {
Write-Verbose “Remove existing policy…”
Remove-WBPolicy -all -force
}
Catch
{
Write-Verbose “No existing policy to remove…”
}

# Create an empty WB Policy Object
Write-Verbose “Create an empty WB Policy Object”
$WBPolicy = New-WBPolicy

# Add Virtual Machine to WB Policy
foreach ($VM in $VMs)
{
Write-Verbose “Add Virtual Machine: $($VM.Name) to WB Policy”
Get-WBVirtualMachine | Where-Object VMName -eq $VM.Name | Add-WBVirtualMachine -Policy $WBPolicy -WarningAction SilentlyContinue
}

# Specify Backup Destination and Define Backup Target
If ($BackupType -eq “Volume”)
{
$Volume = Read-Host “`nEnter Volume Name i.e. E”
Try {
Write-Verbose “Create target volume”
$TargetVol = New-WBBackupTarget -VolumePath $Volume
}
Catch
{
Write-Error -Message “Failed to create target volume $Volume”
return
}
}

If ($BackupType -eq “Disk”)
{
$Disk = Read-Host “`nEnter Disk Name i.e. Seagate”
$Disks = Get-WBDisk | Where-Object {$_.DiskName -like “*$Disk*”}
Try {
Write-Verbose “Create target disk”
$TargetVol = New-WBBackupTarget -Disk $Disks
}
Catch
{
Write-Error -Message “Failed to create target disk $Disk”
return
}
}

If ($BackupType -eq “Network”)
{
Write-Verbose “Enter network share credential”
$Network = Read-Host “`nEnter Network Share i.e. \\server.fqdn\backup”
Try {
$Cred = Get-Credential -Message “Enter Network Share Credential:” -ErrorAction Stop
}
Catch
{
Write-Error -Message “Missing mandatory network Credential”
return
}
Try {
Write-Verbose “Create network share”
$TargetVol = New-WBBackupTarget -NetworkPath $Network -Credential $Cred -NonInheritAcl:$false
}
Catch
{
Write-Error -Message “Failed to create target network share $Network”
return
}
}

# Add Backup Target
Write-Verbose “Add Backup TargeDiskt”
Add-WBBackupTarget -Policy $WBPolicy -Target $TargetVol -WarningAction SilentlyContinue

# Set a schedule
Write-Verbose “Set Schedule”
Set-WBSchedule -Policy $WBPolicy $WBSchedule

# Start the backup
Write-Verbose “Start Backup”
Set-WBPolicy -Policy $WBPolicy -Confirm:$false
Start-WBBackup -Policy $WBPolicy

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s