User Tools

Site Tools


backupmanagement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
backupmanagement [2024/12/25 10:49] – created Darrenbackupmanagement [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+====== User Guide for VM Backup and Snapshot Retention Script ======
  
-## Overview\\+=== 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. 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\\ +==== Features ====  
-Automated VM snapshot creation.\\ +  Automated VM snapshot creation. 
-Retention management for old snapshots.\\ +  Retention management for old snapshots. 
-Configurable backup paths and options.\\ +  Configurable backup paths and options. 
-Dynamic inclusion of VMs via the INI file.\\ +  Dynamic inclusion of VMs via the INI file. 
-Detailed logging of operations.\\ +  Detailed logging of operations. 
-Fully customizable through an easy-to-use configuration file.+  Fully customizable through an easy-to-use configuration file.
  
----+----
  
-## Prerequisites\\ +=== Prerequisites === 
-1. **System Requirements:**\\ +  **System Requirements:** 
- Windows Server or Windows 10/11 with Hyper-V installed.\\ +    Windows Server or Windows 10/11 with Hyper-V installed. 
- PowerShell 5.0 or later.+    PowerShell 5.0 or later.
  
-2. **Required Permissions:**\\ +  - **Required Permissions:** 
- Administrative privileges to manage VMs and access file paths.+    Administrative privileges to manage VMs and access file paths.
  
-3. **Dependencies:**\\ +  - **Dependencies:** 
- - `RoboCopy(built into Windows).+    * ''RoboCopy'' (built into Windows).
  
-4. **Configuration File:**\\ +  - **Configuration File:** 
- A properly formatted INI file must be created and configured.+    A properly formatted INI file must be created and configured.
  
----+----
  
-## Configurable Options\\ +=== Configurable Options === 
-All configurations are stored in the `options.inifile.+All configurations are stored in the ''options.ini'' file.
  
-### Example INI File\\ +==== Example INI File ====  
-```ini\\ +<code ini> 
-[Settings]\\ +[Settings] 
-RetentionDays = 7\\ +RetentionDays = 7 
-LocalPath = C:\VMBackups\\ +LocalPath = C:\VMBackups 
-RemotePath = \\BackupServer\VMs\\ +RemotePath = \\BackupServer\VMs 
-LogPath = C:\VMLogs\\+LogPath = C:\VMLogs
 RoboOpts = /MIR /e /FFT /Z /XA:H /W:5 /compress RoboOpts = /MIR /e /FFT /Z /XA:H /W:5 /compress
  
-[VMs]\\ +[VMs] 
-VM1 = MyVirtualMachine1\\ +VM1 = MyVirtualMachine1 
-VM2 = MyVirtualMachine2\\ +VM2 = MyVirtualMachine2 
-VM3 = MyVirtualMachine3\\ +VM3 = MyVirtualMachine3 
-```+</code>
  
-### Sections and Parameters\\ +==== Sections and Parameters ====  
-1. **[Settings]**\\ +  **[Settings]** 
- - **RetentionDays**: Number of days to retain snapshots before deletion. Older snapshots will be automatically removed.\\ +    - **RetentionDays**: Number of days to retain snapshots before deletion. Older snapshots will be automatically removed. 
-   - **Default:** `7`\\ +      - **Default:** ''7'' 
-   - **Example:** `RetentionDays = 14`\\ +      - **Example:** ''RetentionDays = 14''
- \\ +
- - **LocalPath**: Local directory where the VM files are stored.\\ +
-   - **Example:** `LocalPath = C:\VMBackups`+
  
- - **RemotePath**: Remote destination directory for backupsUse UNC paths for network locations.\\ +    - **LocalPath**: Local directory where the VM files are stored
-   - **Example:** `RemotePath = \\BackupServer\VMs`+      - **Example:** ''LocalPath C:\VMBackups''
  
- - **LogPath**: Directory where log files will be saved.\\ +    - **RemotePath**: Remote destination directory for backups. Use UNC paths for network locations
-   - **Example:** `LogPath C:\VMLogs`+      - **Example:** ''RemotePath = \\BackupServer\VMs''
  
- - **RoboOpts**: Customizable options for RoboCopy. These should be formatted as a single string of space-separated options.\\ +    - **LogPath**: Directory where log files will be saved
-   - **Default:** `/MIR /e /FFT /Z /XA:H /W:5 /compress`\\ +      - **Example:** ''LogPath C:\VMLogs''
-   - **Example:** `RoboOpts /S /ZB /R:3`+
  
-2. **[VMs]**\\ +    - **RoboOpts**: Customizable options for RoboCopyThese should be formatted as single string of space-separated options
- - List of VMs to be backed upEach entry should be in the format `VMx = VMName`, where `x` is unique identifier and `VMName` is the name of the virtual machine.\\ +      - **Default:** ''/MIR /e /FFT /Z /XA:H /W:5 /compress'' 
-   - **Example:**\\ +      - **Example:** ''RoboOpts /S /ZB /R:3''
-     ```ini\\ +
-     [VMs]\\ +
-     VM1 MyVirtualMachine1\\ +
-     VM2 = MyVirtualMachine2\\ +
-     VM3 = MyVirtualMachine3\\ +
-     ```+
  
----+  **[VMs]** 
 +    List of VMs to be backed up. Each entry should be in the format ''VMx = VMName'', where ''x'' is a unique identifier and ''VMName'' is the name of the virtual machine. 
 +      **Example:** 
 +<code ini> 
 +[VMs] 
 +VM1 = MyVirtualMachine1 
 +VM2 = MyVirtualMachine2 
 +VM3 = MyVirtualMachine3 
 +</code>
  
-## Script Functionality+----
  
-### Key Components\\ +=== Script Functionality ===
-1. **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 `RetentionDays` parameter.+
  
-2. **Backup Process**\\ +==== Key Components ====  
- - The script uses RoboCopy to transfer VM files from the `LocalPath` to the `RemotePath`.\\ +  - **Snapshot Management** 
- Configurable options for RoboCopy allow fine-tuning of backup behavior.+    - 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 ''RetentionDays'' parameter.
  
-3. **Logging**\\ +  - **Backup Process** 
- All operations are logged in a file created in the directory specified by `LogPath`.\\ +    The script uses RoboCopy to transfer VM files from the ''LocalPath'' to the ''RemotePath''
- Log entries include timestamps and descriptions of actions performed.+    - Configurable options for RoboCopy allow fine-tuning of backup behavior.
  
----+  **Logging** 
 +    All operations are logged in a file created in the directory specified by ''LogPath''
 +    Log entries include timestamps and descriptions of actions performed.
  
-## How to Use+----
  
-### Step 1: Configure the INI File\\ +=== How to Use ===
-1. Open the `options.ini` file in a text editor.\\ +
-2. Modify the parameters in the `[Settings]` and `[VMs]` sections as needed.\\ +
-3. Save the file.+
  
-### Step 2Run the Script\\ +==== Step 1Configure the INI File ====  
-1. Open a PowerShell window with administrative privileges.\\ +  1. Open the ''options.ini'' file in text editor
-2. Navigate to the directory containing the script.\\ +  2. Modify the parameters in the ''[Settings]'' and ''[VMs]'' sections as needed
-3. Execute the script:\\ +  3. Save the file.
- ```powershell\\ +
- .\BackupScript.ps1\\ +
- ```\\ +
-4. The script will automatically read the `options.ini` file, process VMs, and log the operations.+
  
-### Step 3: Review Logs\+==== Step 2: Run the Script ====  
-- Check the log files in the directory specified by `LogPath` for details of the backup process.+  1. Open a PowerShell window with administrative privileges. 
 +  2. Navigate to the directory containing the script. 
 +  3. Execute the script: 
 +<code powershell> 
 +.\BackupScript.ps1 
 +</code> 
 +  4. The script will automatically read the ''options.ini'' file, process VMs, and log the operations.
  
----+==== Step 3: Review Logs ====  
 +  * Check the log files in the directory specified by ''LogPath'' for details of the backup process.
  
-## Troubleshooting+----
  
-### Common Errors and Solutions\\ +=== Troubleshooting ===
-1. **Error:** "Invalid Parameter #3"\\ +
- - **Cause:** RoboCopy options are not split correctly.\\ +
- - **Solution:** Ensure `RoboOpts` in the INI file is a valid string of space-separated options.+
  
-2. **Error:** "Access Denied"\\ +==== Common Errors and Solutions ====  
- - **Cause:** Insufficient permissions to access VM files or remote path.\\ +  - **Error:** "Invalid Parameter #3
- - **Solution:** Run PowerShell as an administrator and verify permissions for the specified directories.+    - **Cause:** RoboCopy options are not split correctly
 +    - **Solution:** Ensure ''RoboOpts'' in the INI file is a valid string of space-separated options.
  
-3. **Error:** "VM not found"\\ +  - **Error:** "Access Denied
- - **Cause:** VM name in the INI file does not match an existing VM.\\ +    - **Cause:** Insufficient permissions to access VM files or remote path
- - **Solution:** Verify the VM names in the `[VMs]` section of the INI file.+    - **Solution:** Run PowerShell as an administrator and verify permissions for the specified directories.
  
----+  **Error:** "VM not found" 
 +    **Cause:** VM name in the INI file does not match an existing VM. 
 +    **Solution:** Verify the VM names in the ''[VMs]'' section of the INI file.
  
-## Advanced Usage+----
  
-### Customizing RoboCopy Options\\ +=== Advanced Usage ===
-- The `RoboOpts` parameter allows you to customize the behavior of RoboCopy.\\ +
-- Example Options:\\ +
-- `/MIR`: Mirrors the directory structure.\\ +
-- `/Z`: Enables restartable mode for interrupted transfers.\\ +
-- `/XA:H`: Excludes hidden files.\\ +
-- `/R:N`: Specifies the number of retry attempts.+
  
-### Adding or Removing VMs\\ +==== Customizing RoboCopy Options ====  
-To add a VM:\\ +  The ''RoboOpts'' parameter allows you to customize the behavior of RoboCopy
-1. Add a new entry in the `[VMs]` section of the INI file.\\ +  - Example Options
-   - Example: `VM4 = MyVirtualMachine4`\\ +    - ''/MIR'': Mirrors the directory structure
-2. Save the INI file.\\ +    ''/Z''Enables restartable mode for interrupted transfers
-To remove a VM:\\ +    - ''/XA:H'': Excludes hidden files. 
-1Delete the corresponding entry in the `[VMs]` section.\\ +    - ''/R:N'': Specifies the number of retry attempts.
-2Save the INI file.+
  
----+==== Adding or Removing VMs ====  
 +  **To add a VM:** 
 +    1. Add a new entry in the ''[VMs]'' section of the INI file. 
 +       Example: ''VM4 = MyVirtualMachine4'' 
 +    2. Save the INI file.
  
-## Maintenance and Updates\\ +  - **To remove a VM:** 
-- **Log Management:** Periodically clean up old logs in the `LogPath` directory to save space.\\ +    1. Delete the corresponding entry in the ''[VMs]'' section
-- **INI File Updates:** Review and update the INI file as necessary to reflect changes in the VM environment.\\ +    2. Save the INI file.
-- **Script Updates:** Check for script updates to ensure compatibility with the latest systems and features.+
  
----+----
  
-## Contact and Support\\+=== Maintenance and Updates === 
 +  - **Log Management:** Periodically clean up old logs in the ''LogPath'' directory to save space. 
 +  - **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. 
 + 
 +---- 
 + 
 +=== 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.1735123753.txt.gz · Last modified: 2024/12/25 10:49 by Darren

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki