backupmanagement
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
backupmanagement [2024/12/25 10:56] – Darren | backupmanagement [2024/12/30 23:47] (current) – old revision restored (2024/12/25 10:57) Darren | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== User Guide for VM Backup and Snapshot Retention Script ====== | ||
+ | === Overview === | ||
+ | This script automates the process of backing up virtual machines (VMs) and managing snapshot retention. It reads configurations from an external INI file, allowing for customizable settings without modifying the script directly. The script uses PowerShell cmdlets and RoboCopy for backup operations and manages snapshots for virtual machines. | ||
- | **====== | + | ==== Features |
+ | * Automated VM snapshot creation. | ||
+ | * Retention management | ||
+ | * Configurable backup paths and options. | ||
+ | * Dynamic inclusion of VMs via the INI file. | ||
+ | | ||
+ | | ||
- | **=== Overview ===\\ | + | ---- |
- | This script automates the process of backing up virtual machines (VMs) and managing snapshot retention. It reads configurations from an external INI file, allowing for customizable settings without modifying the script directly. The script uses PowerShell cmdlets and RoboCopy for backup operations and manages snapshots for virtual machines.** | + | |
- | **==== Features | + | === Prerequisites |
- | * Automated VM snapshot creation.\\ | + | |
- | * Retention management for old snapshots.\\ | + | * Windows Server or Windows 10/11 with Hyper-V installed. |
- | * Configurable backup paths and options.\\ | + | * PowerShell 5.0 or later. |
- | * Dynamic inclusion of VMs via the INI file.\\ | + | |
- | * Detailed logging of operations.\\ | + | |
- | * Fully customizable through an easy-to-use configuration file.** | + | |
- | **----** | + | - **Required Permissions: |
+ | | ||
- | **=== Prerequisites ===\\ | + | |
- | - **System Requirements:**\\ | + | * '' |
- | * Windows | + | |
- | * PowerShell 5.0 or later.** | + | |
- | ** - **Required Permissions:**\\ | + | |
- | * Administrative privileges to manage VMs and access file paths.** | + | * A properly formatted INI file must be created |
- | ** - **Dependencies: | + | ---- |
- | * '' | + | |
- | ** - **Configuration File:**\\ | + | === Configurable Options === |
- | * A properly formatted INI file must be created and configured.** | + | All configurations are stored in the '' |
- | **----** | + | ==== Example INI File ==== |
+ | <code ini> | ||
+ | [Settings] | ||
+ | RetentionDays = 7 | ||
+ | LocalPath = C: | ||
+ | RemotePath = \\BackupServer\VMs | ||
+ | LogPath = C:\VMLogs | ||
+ | RoboOpts = /MIR /e /FFT /Z /XA:H /W:5 /compress | ||
- | **=== Configurable Options | + | [VMs] |
- | All configurations are stored in the '' | + | VM1 = MyVirtualMachine1 |
+ | VM2 = MyVirtualMachine2 | ||
+ | VM3 = MyVirtualMachine3 | ||
+ | </ | ||
- | **==== Example INI File ==== \\ | + | ==== Sections and Parameters |
- | <code ini>\\ | + | - **[Settings]** |
- | [Settings]\\ | + | - **RetentionDays**: Number of days to retain snapshots before deletion. Older snapshots will be automatically removed. |
- | RetentionDays | + | - **Default:** '' |
- | LocalPath = C:\VMBackups\\ | + | - **Example:** '' |
- | RemotePath = \\BackupServer\VMs\\ | + | |
- | LogPath = C:\VMLogs\\ | + | |
- | RoboOpts = /MIR /e /FFT /Z /XA:H /W:5 /compress** | + | |
- | **[VMs]\\ | + | - **LocalPath**: |
- | VM1 = MyVirtualMachine1\\ | + | - **Example: |
- | VM2 = MyVirtualMachine2\\ | + | |
- | VM3 = MyVirtualMachine3\\ | + | |
- | </ | + | - **RemotePath**: |
+ | - **Example: | ||
- | **==== Sections and Parameters ==== \\ | + | |
- | - **[Settings]**\\ | + | - **Example: |
- | - **RetentionDays**: Number of days to retain snapshots before deletion. Older snapshots | + | |
- | - **Default: | + | |
- | | + | |
- | ** | + | - **RoboOpts**: Customizable options for RoboCopy. These should be formatted as a single string of space-separated options. |
- | - **Example: | + | |
+ | - **Example: | ||
- | ** | + | - **[VMs]** |
- | - **Example: | + | - List of VMs to be backed up. Each entry should be in the format '' |
- | + | - **Example: | |
- | ** - **LogPath**: | + | <code ini> |
- | - **Example: | + | [VMs] |
- | + | VM1 = MyVirtualMachine1 | |
- | ** - **RoboOpts**: | + | VM2 = MyVirtualMachine2 |
- | - **Default: | + | VM3 = MyVirtualMachine3 |
- | - **Example: | + | </ |
- | + | ||
- | ** - **[VMs]**\\ | + | |
- | - List of VMs to be backed up. Each entry should be in the format '' | + | |
- | - **Example: | + | |
- | <code ini>\\ | + | |
- | [VMs]\\ | + | |
- | VM1 = MyVirtualMachine1\\ | + | |
- | VM2 = MyVirtualMachine2\\ | + | |
- | VM3 = MyVirtualMachine3\\ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | **----** | + | |
- | **=== Script Functionality ===** | + | ---- |
- | **==== Key Components | + | === Script Functionality |
- | - **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**\\ | + | ==== Key Components ==== |
- | - The script | + | |
- | - Configurable options for RoboCopy allow fine-tuning of backup behavior.** | + | - The script |
+ | - Old snapshots are removed based on the retention period defined in the '' | ||
- | ** - **Logging**\\ | + | |
- | - All operations are logged in a file created in the directory specified by '' | + | - The script uses RoboCopy to transfer VM files from the '' |
- | - Log entries include timestamps and descriptions | + | - Configurable options for RoboCopy allow fine-tuning |
- | **----** | + | - **Logging** |
+ | | ||
+ | | ||
- | **=== How to Use ===** | + | ---- |
- | **==== Step 1: Configure the INI File ==== \\ | + | === How to Use === |
- | 1. Open the '' | + | |
- | 2. Modify the parameters in the '' | + | |
- | 3. Save the file.** | + | |
- | **==== Step 2: Run the Script | + | ==== Step 1: Configure |
- | 1. Open a PowerShell window with administrative privileges.\\ | + | 1. Open the '' |
- | 2. Navigate to the directory containing | + | 2. Modify |
- | 3. Execute | + | 3. Save the file. |
- | <code powershell> | + | |
- | .\BackupScript.ps1\\ | + | |
+ | ==== 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 ==== \\ | + | ==== Step 3: Review Logs ==== |
- | * Check the log files in the directory specified by '' | + | * Check the log files in the directory specified by '' |
- | **----** | + | ---- |
- | **=== Troubleshooting ===** | + | === Troubleshooting === |
- | **==== Common Errors and Solutions ==== \\ | + | ==== Common Errors and Solutions ==== |
- | - **Error:** " | + | - **Error:** " |
- | - **Cause:** RoboCopy options are not split correctly.\\ | + | - **Cause:** RoboCopy options are not split correctly. |
- | - **Solution: | + | - **Solution: |
- | ** - **Error:** " | + | |
- | - **Cause:** Insufficient permissions to access VM files or remote path.\\ | + | - **Cause:** Insufficient permissions to access VM files or remote path. |
- | - **Solution: | + | - **Solution: |
- | ** - **Error:** "VM not found"\\ | + | |
- | - **Cause:** VM name in the INI file does not match an existing VM.\\ | + | - **Cause:** VM name in the INI file does not match an existing VM. |
- | - **Solution: | + | - **Solution: |
- | **----** | + | ---- |
- | **=== Advanced Usage ===** | + | === Advanced Usage === |
- | **==== Customizing RoboCopy Options ==== \\ | + | ==== Customizing RoboCopy Options ==== |
- | - The '' | + | - The '' |
- | - Example Options:\\ | + | - Example Options: |
- | - ''/ | + | - ''/ |
- | - ''/ | + | - ''/ |
- | - ''/ | + | - ''/ |
- | - ''/ | + | - ''/ |
- | **==== Adding or Removing VMs ==== \\ | + | ==== Adding or Removing VMs ==== |
- | - **To add a VM:**\\ | + | - **To add a VM:** |
- | 1. Add a new entry in the '' | + | 1. Add a new entry in the '' |
- | | + | |
- | 2. Save the INI file.** | + | 2. Save the INI file. |
- | ** - **To remove a VM:**\\ | + | |
- | 1. Delete the corresponding entry in the '' | + | 1. Delete the corresponding entry in the '' |
- | 2. Save the INI file.** | + | 2. Save the INI file. |
- | **----** | + | ---- |
- | **=== Maintenance and Updates ===\\ | + | === Maintenance and Updates === |
- | - **Log Management: | + | - **Log Management: |
- | - **INI File Updates:** Review and update the INI file as necessary to reflect changes in the VM environment.\\ | + | - **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.** | + | - **Script Updates:** Check for script updates to ensure compatibility with the latest systems and features. |
- | **----** | + | ---- |
- | **=== Contact and Support ===\\ | + | === Contact and Support === |
- | For questions or issues, please contact the script author or system administrator.** | + | For questions or issues, please contact the script author or system administrator. |
/var/www/wiki.darrenwindle.co.uk/public_html/data/attic/backupmanagement.1735124204.txt.gz · Last modified: 2024/12/25 10:56 by Darren