]> git.p6c8.net - dsmonrot.git/blobdiff - dsmonrot.ps1
Updated TODO
[dsmonrot.git] / dsmonrot.ps1
index ddaae59273511a17037a615a0008783acdeb254c..ffe4f461f7da51b1e8a3dd297d2bb4753772cd87 100644 (file)
@@ -15,7 +15,7 @@
 # This directory MUST exist, it is not created automatically!\r
 [String]$backupDir = "Z:\"\r
 # Disks to backup, see http://www.drivesnapshot.de/en/commandline.htm\r
 # This directory MUST exist, it is not created automatically!\r
 [String]$backupDir = "Z:\"\r
 # Disks to backup, see http://www.drivesnapshot.de/en/commandline.htm\r
-[String]$disksToBackup = "D1:1"\r
+[String]$disksToBackup = "HD1:1"\r
 # Path to Drive Snapshot\r
 [String]$dsPath = "C:\Users\Patrick\Desktop\DSMonRot\snapshot.exe"\r
 # Keep backups for this amount of months (excluding the current month),\r
 # Path to Drive Snapshot\r
 [String]$dsPath = "C:\Users\Patrick\Desktop\DSMonRot\snapshot.exe"\r
 # Keep backups for this amount of months (excluding the current month),\r
 # 0 or less for indefinite\r
 # You should set this to at least the same as $keepMonths\r
 [Int32]$keepLogs = 2\r
 # 0 or less for indefinite\r
 # You should set this to at least the same as $keepMonths\r
 [Int32]$keepLogs = 2\r
+# Comma separated lists of files and directories to exclude from the backup\r
+# See http://www.drivesnapshot.de/en/commandline.htm\r
+# Comment out if you don't want to use it\r
+#[String]$excludedPaths = "Path1,Path2"\r
 \r
 # Map network share to this drive letter, comment out if you don't want to use it\r
 [String]$smbDrive = "Z"\r
 \r
 # Map network share to this drive letter, comment out if you don't want to use it\r
 [String]$smbDrive = "Z"\r
@@ -211,7 +215,7 @@ function Send-Email([String]$body) {
        }\r
 }\r
 \r
        }\r
 }\r
 \r
-function Rotate-Backup {\r
+function Invoke-BackupRotation {\r
        if($keepMonths -lt 0) {\r
                return\r
        }\r
        if($keepMonths -lt 0) {\r
                return\r
        }\r
@@ -231,7 +235,7 @@ function Rotate-Backup {
        }\r
 }\r
 \r
        }\r
 }\r
 \r
-function Rotate-Log {\r
+function Invoke-LogRotation {\r
        if($keepLogs -le 0) {\r
                return\r
        }\r
        if($keepLogs -le 0) {\r
                return\r
        }\r
@@ -327,8 +331,13 @@ if($errorMessages.Count -eq 0) {
                        $backupTargetDiff = $backupTargetDiff + "-" + $currTime\r
                }\r
 \r
                        $backupTargetDiff = $backupTargetDiff + "-" + $currTime\r
                }\r
 \r
+               # Compose the "exclude" parameter if necessary\r
+               if($excludedPaths) {\r
+                       $dsAdditionalArgs += "--exclude:" + $excludedPaths\r
+               }\r
+\r
                # Check if the backup target for this month, the directory for the full backup\r
                # Check if the backup target for this month, the directory for the full backup\r
-               # and the hash files exists. In this case we do a differential backup.\r
+               # and the hash files exist. In that case we do a differential backup.\r
                if((Test-Path $backupTarget) -and (Test-Path $backupTargetFull) -and (Test-Path "$backupTargetFull\*.hsh")) {\r
                        # Do a differential backup\r
                \r
                if((Test-Path $backupTarget) -and (Test-Path $backupTargetFull) -and (Test-Path "$backupTargetFull\*.hsh")) {\r
                        # Do a differential backup\r
                \r
@@ -398,7 +407,7 @@ if($errorMessages.Count -eq 0) {
                                \r
                                if($errorMessages.Count -eq 0) {\r
                                        if($rotateBeforeBackup) {\r
                                \r
                                if($errorMessages.Count -eq 0) {\r
                                        if($rotateBeforeBackup) {\r
-                                               Rotate-Backup\r
+                                               Invoke-BackupRotation\r
                                        }\r
                                        \r
                                        $dsLogPath = if($dsLogFileToBackup) { "$backupTargetFull\$dsLogFile" } else { $dsLogFile }\r
                                        }\r
                                        \r
                                        $dsLogPath = if($dsLogFileToBackup) { "$backupTargetFull\$dsLogFile" } else { $dsLogFile }\r
@@ -420,7 +429,7 @@ if($errorMessages.Count -eq 0) {
                                        }\r
                                        \r
                                        if($rotateBeforeBackup -eq $False -and $success -eq $True) {\r
                                        }\r
                                        \r
                                        if($rotateBeforeBackup -eq $False -and $success -eq $True) {\r
-                                               Rotate-Backup\r
+                                               Invoke-BackupRotation\r
                                        }\r
                                }\r
                        }\r
                                        }\r
                                }\r
                        }\r
@@ -441,7 +450,8 @@ if($errorMessages.Count -eq 0) {
        }\r
        \r
        # Rotate the log files\r
        }\r
        \r
        # Rotate the log files\r
-       Rotate-Log\r
+       Invoke-LogRotation\r
+\r
 }\r
 \r
 # If there was any error message recorded, send a mail if configured\r
 }\r
 \r
 # If there was any error message recorded, send a mail if configured\r

patrick-canterino.de