Error loading plugin mermaid
ParseError: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
More info is available in the error log.
ParseError: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
More info is available in the error log.
backupmanagement
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| backupmanagement [2024/12/30 23:46] – Darren | backupmanagement [2024/12/30 23:47] (current) – old revision restored (2024/12/25 10:57) Darren | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | === VM Backup and Snapshot Retention Script ====== | + | ====== User Guide for VM Backup and Snapshot Retention Script ====== |
| - | ===== Purpose | + | === Overview |
| - | This PowerShell | + | This script automates the process of backing |
| - | * Backing | + | |
| - | * Retaining snapshots | + | |
| - | * Logging the entire process | + | |
| - | * Sending email notifications upon success or failure.\\ | + | |
| - | * Providing a Windows-like progress box for user feedback. | + | |
| - | ===== Features =====\\ | + | ==== Features ==== |
| - | * **INI-Based Configuration**: | + | * Automated VM snapshot creation. |
| - | * **Snapshot | + | * Retention |
| - | * **Automated Backup**: Uses `RoboCopy` to back up VM files to a remote or local destination.\\ | + | * Configurable backup paths and options. |
| - | * **Email Notifications**: | + | * Dynamic inclusion |
| - | * **Progress Box**: Displays a Windows-like GUI progress bar during the backup process. | + | * Detailed logging of operations. |
| + | | ||
| ---- | ---- | ||
| - | ===== Prerequisites =====\\ | + | === Prerequisites === |
| - | - **PowerShell Version**: Ensure | + | - **System Requirements: |
| - | - **Hyper-V Module**: The script uses `Checkpoint-VM`, | + | * Windows Server or Windows 10/11 with Hyper-V installed. |
| - | - **INI File Configuration**: The script relies on an `.ini` file for settings.\\ | + | * PowerShell 5.0 or later. |
| - | - **Windows Forms Assembly**: The script uses `System.Windows.Forms` for the progress box. This is included by default on Windows. | + | |
| + | | ||
| + | * Administrative privileges to manage VMs and access file paths. | ||
| + | |||
| + | | ||
| + | * '' | ||
| + | |||
| + | | ||
| + | * A properly formatted INI file must be created and configured. | ||
| ---- | ---- | ||
| - | ===== Configuration ===== | + | === Configurable Options |
| + | All configurations are stored in the '' | ||
| - | ==== INI File ====\\ | + | ==== Example |
| - | The script uses an `.ini` file located at: | + | <code ini> |
| + | [Settings] | ||
| + | RetentionDays = 7 | ||
| + | LocalPath = C:\VMBackups | ||
| + | RemotePath = \\BackupServer\VMs | ||
| + | LogPath = C:\VMLogs | ||
| + | RoboOpts = /MIR /e /FFT /Z /XA:H /W:5 /compress | ||
| - | **`C:\Program Files\SyncVM\options.ini`** | + | [VMs] |
| + | VM1 = MyVirtualMachine1 | ||
| + | VM2 = MyVirtualMachine2 | ||
| + | VM3 = MyVirtualMachine3 | ||
| + | </ | ||
| + | |||
| + | ==== Sections and Parameters ==== | ||
| + | - **[Settings]** | ||
| + | - **RetentionDays**: | ||
| + | - **Default: | ||
| + | - **Example: | ||
| + | |||
| + | - **LocalPath**: | ||
| + | - **Example: | ||
| + | |||
| + | - **RemotePath**: | ||
| + | - **Example: | ||
| + | |||
| + | - **LogPath**: | ||
| + | - **Example: | ||
| + | |||
| + | - **RoboOpts**: | ||
| + | - **Default: | ||
| + | - **Example: | ||
| + | |||
| + | - **[VMs]** | ||
| + | - List of VMs to be backed up. Each entry should be in the format '' | ||
| + | - **Example: | ||
| + | < | ||
| + | [VMs] | ||
| + | VM1 = MyVirtualMachine1 | ||
| + | VM2 = MyVirtualMachine2 | ||
| + | VM3 = MyVirtualMachine3 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | === Script Functionality === | ||
| + | |||
| + | ==== Key Components ==== | ||
| + | - **Snapshot Management** | ||
| + | - The script creates a snapshot for each VM listed in the INI file. | ||
| + | - Old snapshots are removed based on the retention period defined in the '' | ||
| + | |||
| + | - **Backup Process** | ||
| + | - The script uses RoboCopy to transfer VM files from the '' | ||
| + | - Configurable options for RoboCopy allow fine-tuning of backup behavior. | ||
| + | |||
| + | - **Logging** | ||
| + | - All operations are logged in a file created in the directory specified by '' | ||
| + | - Log entries include timestamps and descriptions of actions performed. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | === How to Use === | ||
| + | |||
| + | ==== Step 1: Configure the INI File ==== | ||
| + | 1. Open the '' | ||
| + | 2. Modify the parameters in the '' | ||
| + | 3. Save the file. | ||
| + | |||
| + | ==== Step 2: Run the Script ==== | ||
| + | 1. Open a PowerShell window with administrative privileges. | ||
| + | 2. Navigate to the directory containing the script. | ||
| + | 3. Execute the script: | ||
| + | <code powershell> | ||
| + | .\BackupScript.ps1 | ||
| + | </ | ||
| + | 4. The script will automatically read the '' | ||
| + | |||
| + | ==== Step 3: Review Logs ==== | ||
| + | * Check the log files in the directory specified by '' | ||
| + | |||
| + | ---- | ||
| + | |||
| + | === Troubleshooting === | ||
| + | |||
| + | ==== Common Errors and Solutions ==== | ||
| + | - **Error:** " | ||
| + | - **Cause:** RoboCopy options are not split correctly. | ||
| + | - **Solution: | ||
| + | |||
| + | - **Error:** " | ||
| + | - **Cause:** Insufficient permissions to access VM files or remote path. | ||
| + | - **Solution: | ||
| + | |||
| + | - **Error:** "VM not found" | ||
| + | - **Cause:** VM name in the INI file does not match an existing VM. | ||
| + | - **Solution: | ||
| + | |||
| + | ---- | ||
| + | |||
| + | === Advanced Usage === | ||
| + | |||
| + | ==== Customizing RoboCopy Options ==== | ||
| + | - The '' | ||
| + | - Example Options: | ||
| + | - ''/ | ||
| + | - ''/ | ||
| + | - ''/ | ||
| + | - ''/ | ||
| + | |||
| + | ==== Adding or Removing VMs ==== | ||
| + | - **To add a VM:** | ||
| + | 1. Add a new entry in the '' | ||
| + | - Example: '' | ||
| + | 2. Save the INI file. | ||
| + | |||
| + | - **To remove a VM:** | ||
| + | 1. Delete the corresponding entry in the '' | ||
| + | 2. Save the INI file. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | === Maintenance and Updates === | ||
| + | - **Log Management: | ||
| + | - **INI File Updates:** Review and update the INI file as necessary to reflect changes in the VM environment. | ||
| + | - **Script Updates:** Check for script updates to ensure compatibility with the latest systems and features. | ||
| + | |||
| + | ---- | ||
| - | Below is an example `.ini` file with all available settings: | + | === Contact and Support === |
| + | For questions or issues, please contact the script author or system administrator. | ||
/var/www/wiki.darrenwindle.co.uk/public_html/data/pages/backupmanagement.txt · Last modified: 2024/12/30 23:47 by Darren