One of my first posts here on my blog was about the two PowerShell scripts that I made for taking snapshots and backup of Virtual Machines. It was a simple script, but alot of people seemed to like them. Time has passed, and iv'e changed how I want to perform my backups.
How to configure Windows Server Backup
-
Install the Windows Server Backup feature with Server Manager, and make sure you include the command-line tools available.
-
Add this string to the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WindowsServerBackup\Application Support\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}\Application Identifier\Hyper-V
Link: http://support.microsoft.com/kb/958662
-
Restart the server
-
Start Windows Server Backup and create a new schedule.
Select C: and the volume you have your VM's on. (Do not select .vhd files directly, apparently VSS doesn't like that)
Select a dedicated backup location. (The backup will fail under schedule if you select a normal volume)
-
Try to run the backup once, it should run without fail. :)
(Bonus) Monitor your backup in case of an error
A backup is no good if you don't get notified if there was an error. It's a classic when companies find out that their backup solution stopped working 6 months ago, just when they needed the backup.
I've created a new simple PowerShell script that checks the last successfull backup. The script will send an email if the last successfull backup is older than a given amount of hours.
Configuration is in the start of the script. By default the script will check if last backup is older than 24 hours, and it will also send a "backup succeded" mail.
BackupCheck.ps1 (1.04 kb)
To configure a schedule for the script to run, start Task Scheduler and create a new task.
Under Action, click Add and enter Powershell as program and "& 'C:\Hyper-V\BackupCheck.ps1'" as argument.
Under Triggers, click Add and enter your desired intervall. I've set mine to run 2 hours after the backup schedule.
With this you should be able to have a pretty good overview over your backup :)