- Write-Host "Directory $backupTargetDiff already exists!"\r
- $errorMessages += "Directory $backupTargetDiff already exists!"\r
- }\r
-}\r
-else {\r
- Write-Host "Full backup"\r
- \r
- if(!(Test-Path $backupTarget)) {\r
- Write-Host "Creating directory $backupTarget"\r
- New-Item -ItemType directory -Path $backupTarget\r
- }\r
- \r
- if(!(Test-Path $backupTargetFull)) {\r
- Write-Host "Creating directory $backupTargetFull"\r
- New-Item -ItemType directory -Path $backupTargetFull\r
- }\r
- \r
- $dsLogPath = if($dsLogFileToBackup) { "$backupTargetFull\$dsLogFile" } else { $dsLogFile }\r
-\r
- $dsArgs = @($disksToBackup, "--logfile:$dsLogPath", "$backupTargetFull\`$disk.sna") + $dsAdditionalArgs\r
- Write-Host $dsPath ($dsArgs -join " ")\r
- \r
- & $dsPath $dsArgs\r
- \r
- if($LastExitCode -ne 0) {\r
- Write-Host "Drive Snapshot failed to backup! Exit code: $LastExitCode"\r
- $errorMessages += "Drive Snapshot failed to backup! Exit code: $LastExitCode"\r
- }\r
- else {\r
- $success = $True\r
- }\r
-}\r