This is an old revision of the document!
VM Backup and Snapshot Retention Script
===== Purpose =====
This PowerShell script automates the process of:
* Backing up Hyper-V virtual machines (VMs).
* Retaining snapshots for a configurable period.
* Logging the entire process for audit and troubleshooting purposes.
* Sending email notifications upon success or failure.
* Providing a Windows-like progress box for user feedback.
===== Features =====
* INI-Based Configuration: All settings, including email and paths, are configured via an easy-to-edit `.ini` file.
* Snapshot Retention: Removes old snapshots based on the retention period defined in the `.ini` file.
* Automated Backup: Uses `RoboCopy` to back up VM files to a remote or local destination.
* Email Notifications: Notifies the user of the script's success or failure.
* Progress Box: Displays a Windows-like GUI progress bar during the backup process.
===== Prerequisites =====
- PowerShell Version: Ensure PowerShell 5.1 or later is installed.
- Hyper-V Module: The script uses `Checkpoint-VM`, `Get-VMSnapshot`, and `Remove-VMSnapshot`. The Hyper-V PowerShell module must be installed.
- INI File Configuration: The script relies on an `.ini` file for settings.
- Windows Forms Assembly: The script uses `System.Windows.Forms` for the progress box. This is included by default on Windows.
Configuration
==== INI File ====
The script uses an `.ini` file located at:
`C:\Program Files\SyncVM\options.ini`
Below is an example `.ini` file with all available settings: