User Tools

Site Tools


backupmanagement

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
backupmanagement [2024/12/25 10:56] 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 ======
  
 +=== 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.
  
-**====== User Guide for VM Backup and Snapshot Retention Script ======**+==== Features ====  
 +  * Automated VM snapshot creation. 
 +  * Retention management for old snapshots. 
 +  * Configurable backup paths and options. 
 +  * Dynamic inclusion of VMs via the INI file. 
 +  Detailed logging of operations. 
 +  Fully customizable through an easy-to-use configuration 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.\\ +  **System Requirements:** 
-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:** 
 +    Administrative privileges to manage VMs and access file paths.
  
-**=== Prerequisites ===\\ +  - **Dependencies:** 
-- **System Requirements:**\\ +    ''RoboCopy'' (built into Windows).
-  * Windows Server or Windows 10/11 with Hyper-V installed.\\ +
-  * PowerShell 5.0 or later.**+
  
-** - **Required Permissions:**\\ +  - **Configuration File:** 
-  Administrative privileges to manage VMs and access file paths.**+    A properly formatted INI file must be created and configured.
  
-** **Dependencies:**\\ +----
-  * ''RoboCopy'' (built into Windows).**+
  
-** - **Configuration File:**\\ +=== Configurable Options === 
-  * A properly formatted INI file must be created and configured.**+All configurations are stored in the ''options.ini'' file.
  
-**----**+==== Example INI File ====  
 +<code ini> 
 +[Settings] 
 +RetentionDays = 7 
 +LocalPath = C:\VMBackups 
 +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 ''options.ini'' file.**+VM1 MyVirtualMachine1 
 +VM2 MyVirtualMachine2 
 +VM3 MyVirtualMachine3 
 +</code>
  
-**==== 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 = 7\\ +      - **Default:** ''7'' 
-LocalPath = C:\VMBackups\\ +      - **Example:** ''RetentionDays = 14''
-RemotePath = \\BackupServer\VMs\\ +
-LogPath = C:\VMLogs\\ +
-RoboOpts = /MIR /e /FFT /Z /XA:H /W:5 /compress**+
  
-**[VMs]\\ +    - **LocalPath**: Local directory where the VM files are stored. 
-VM1 MyVirtualMachine1\\ +      - **Example:** ''LocalPath C:\VMBackups''
-VM2 = MyVirtualMachine2\\ +
-VM3 = MyVirtualMachine3\\+
  
-</code>**+    - **RemotePath**: Remote destination directory for backups. Use UNC paths for network locations. 
 +      - **Example:** ''RemotePath = \\BackupServer\VMs''
  
-**==== Sections and Parameters ==== \\ +    - **LogPath**: Directory where log files will be saved
-- **[Settings]**\\ +      - **Example:** ''LogPath C:\VMLogs''
-  - **RetentionDays**: Number of days to retain snapshots before deletion. Older snapshots will be automatically removed.\\ +
-    - **Default:** ''7''\\ +
-    - **Example:** ''RetentionDays 14''**+
  
-**   - **LocalPath**: Local directory where the VM files are stored.\\ +    - **RoboOpts**: Customizable options for RoboCopy. These should be formatted as a single string of space-separated options. 
-    - **Example:** ''LocalPath C:\VMBackups''**+      - **Default:** ''/MIR /e /FFT /Z /XA:H /W:5 /compress'' 
 +      - **Example:** ''RoboOpts /S /ZB /R:3''
  
-**   - **RemotePath**: Remote destination directory for backups. Use UNC paths for network locations.\\ +  - **[VMs]** 
-    - **Example:** ''RemotePath = \\BackupServer\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:** 
-**   - **LogPath**: Directory where log files will be saved.\\ +<code ini> 
-    - **Example:** ''LogPath = C:\VMLogs''** +[VMs] 
- +VM1 = MyVirtualMachine1 
-**   - **RoboOpts**: Customizable options for RoboCopy. These should be formatted as a single string of space-separated options.\\ +VM2 = MyVirtualMachine2 
-    - **Default:** ''/MIR /e /FFT /Z /XA:H /W:5 /compress''\\ +VM3 = MyVirtualMachine3 
-    - **Example:** ''RoboOpts = /S /ZB /R:3''** +</code>
- +
-** - **[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 ===
-- **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.**+
  
-** - **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.
  
-** - **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.
-<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
 </code> </code>
-4. The script will automatically read the ''options.ini'' file, process VMs, and log the operations.**+  4. The script will automatically read the ''options.ini'' file, process VMs, and log the operations.
  
-**==== Step 3: Review Logs ==== \\ +==== Step 3: Review Logs ====  
-* Check the log files in the directory specified by ''LogPath'' for details of the backup process.**+  * Check the log files in the directory specified by ''LogPath'' for details of the backup process.
  
-**----**+----
  
-**=== Troubleshooting ===**+=== Troubleshooting ===
  
-**==== Common Errors and Solutions ==== \\ +==== Common Errors and Solutions ====  
-- **Error:** "Invalid Parameter #3"\\ +  - **Error:** "Invalid Parameter #3" 
-  - **Cause:** RoboCopy options are not split correctly.\\ +    - **Cause:** RoboCopy options are not split correctly. 
-  - **Solution:** Ensure ''RoboOpts'' in the INI file is a valid string of space-separated options.**+    - **Solution:** Ensure ''RoboOpts'' in the INI file is a valid string of space-separated options.
  
-** - **Error:** "Access Denied"\\ +  - **Error:** "Access Denied" 
-  - **Cause:** Insufficient permissions to access VM files or remote path.\\ +    - **Cause:** Insufficient permissions to access VM files or remote path. 
-  - **Solution:** Run PowerShell as an administrator and verify permissions for the specified directories.**+    - **Solution:** Run PowerShell as an administrator and verify permissions for the specified directories.
  
-** - **Error:** "VM not found"\\ +  - **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:** Verify the VM names in the ''[VMs]'' section of the INI file.**+    - **Solution:** Verify the VM names in the ''[VMs]'' section of the INI file.
  
-**----**+----
  
-**=== Advanced Usage ===**+=== Advanced Usage ===
  
-**==== Customizing RoboCopy Options ==== \\ +==== Customizing RoboCopy Options ====  
-- The ''RoboOpts'' parameter allows you to customize the behavior of RoboCopy.\\ +  - The ''RoboOpts'' parameter allows you to customize the behavior of RoboCopy. 
-- Example Options:\\ +  - Example Options: 
-  - ''/MIR'': Mirrors the directory structure.\\ +    - ''/MIR'': Mirrors the directory structure. 
-  - ''/Z'': Enables restartable mode for interrupted transfers.\\ +    - ''/Z'': Enables restartable mode for interrupted transfers. 
-  - ''/XA:H'': Excludes hidden files.\\ +    - ''/XA:H'': Excludes hidden files. 
-  - ''/R:N'': Specifies the number of retry attempts.**+    - ''/R:N'': Specifies the number of retry attempts.
  
-**==== Adding or Removing VMs ==== \\ +==== Adding or Removing VMs ====  
-- **To add a VM:**\\ +  - **To add a VM:** 
-  1. Add a new entry in the ''[VMs]'' section of the INI file.\\ +    1. Add a new entry in the ''[VMs]'' section of the INI file. 
-     - Example: ''VM4 = MyVirtualMachine4''\\ +       - Example: ''VM4 = MyVirtualMachine4'' 
-  2. Save the INI file.**+    2. Save the INI file.
  
-** - **To remove a VM:**\\ +  - **To remove a VM:** 
-  1. Delete the corresponding entry in the ''[VMs]'' section.\\ +    1. Delete the corresponding entry in the ''[VMs]'' section. 
-  2. Save the INI file.**+    2. Save the INI file.
  
-**----**+----
  
-**=== Maintenance and Updates ===\\ +=== Maintenance and Updates === 
-- **Log Management:** Periodically clean up old logs in the ''LogPath'' directory to save space.\\ +  - **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.\\ +  - **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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki