Categories
Uncategorized

Creating Hyper-V backups in Windows 10

Download and run the script from Mike Galvin.

Create folder c:\scripts

Create folder c:\scripts\logs

Create folder c:\scripts\vms

Save code from: https://github.com/Digressive/HyperV-Backup-Utility/blob/master/Hyper-V-Backup.ps1 to file Hyper-V-Backup.ps1 in the folder c:\scripts

Create a text file called c:\scripts\vms.txt and on a separate line list each Hyper-V VM name you would like to backup.

Right click on powershell and run as administrator

Run: C:\scripts\Hyper-V-Backup.ps1 -BackupTo C:\scripts\vms C:\scripts\vms.txt -Keep 4 -L C:\scripts\logs

More options available such as compress and email.

Source: https://gal.vin/2017/09/18/vm-backup-for-hyper-v/

Schedule the task with Task scheduler

Open task scheduler by typing in taskschd.msc

Action > Create Task

Enter in a name like “Backup VMs”

Select “Run whether user is logged on or not”

Configure for: “Windows 10”

Tab Triggers

Daily, select start date / time

Stop task if it runs longer than: 4 hours (or whatever works for you)

Tab Actions

Enter “powershell” in program / script

Enter for “Add arguments (optional):” C:\scripts\Hyper-V-Backup.ps1 -BackupTo C:\scripts\vms C:\scripts\vms.txt -Keep 4 -L C:\scripts\logs

Tab Settings

Check the following:

“Allow task to be run on demand”
“Run task as soon as possible after a scheduled start is missed”
“Stop the task if it runs longer than: 4 hours (or whatever works for you)
“If the running task does not end when requested, force it to stop”