Overview
HyperV Simple Backup. Creates up to 4 dated backups of the HyperV VMs to a folder location (Removing the oldest). Uses this basic command: Get-VM | Export-VM

See GitHub to download or for more information: https://github.com/ITAutomator/HyperVBackup
Run
The program will run nightly in Task Schedule
OR
Right-click the task in Task Scheduler and choose run (to run now)
OR
Right-click ‘HyperV Backup.cmd’ Run as Admin
Setup
Copy Files
Copy these files to C:\HyperVBackup
The script puts the backups in a subdirectory of this folder.
Configure
HyperV Backup.ps1 The main program
HyperV Backup.cmd Just an easy way to run the .ps1 as admin
HyperV Backup.xml Configuration file (create on first launch)
BackupsFolder D:\HyperVBackups Location of your backups (will create folder)
BackupsToKeep 4 To adjust the number of backups
VMExcludes To exclude some named VMs from the backup
HyperV Backup (TaskSchedImport).xml Import this into Task Scheduler
Schedule
Open Task Scheduler and Import the .xml file. Adjust as needed
Run as user: you will see the program run interactively
Run whether logged on or not: won’t see it run
In this case ‘user account’ can be SYSTEM
Restore
Hyper V Manager > Right-click VM host > Import
Select exported folder (not file) > choose the snapshot date and Import
More
Use FolderCopyWithPruning.ps1 to send some of these backups to offsite or cloud on a monthly basis