$databasesToBackup = @()
if($configDbBackup -and $configDbBackup.count -gt 0) {
- $databasesToBackup = $configDbBackup
+ foreach($cDb in $configDbBackup) {
+ if($cDb -in $databases) {
+ $databasesToBackup += $cDb
+ }
+ else {
+ Write-Warning "Not backing up database $cDb, because it does not exist"
+ }
+ }
}
else {
$databasesToBackup = $databases
try {
Create-Backup $d $databaseBackupFile
+ Rotate-Backups $databaseBackupDir
}
catch {
Write-Output "Could not backup database $d to $databaseBackupFile"
Write-Output $_
}
-
- Rotate-Backups $databaseBackupDir
}
\ No newline at end of file