So Microsoft DPM software is a pretty decent backup solution, but it does have a nasty tendency to not remove old backups correctly even if retention policies are set. This can happen for a multitude of reasons that I won’t go into.
This article is going to very quickly go over how you can remove backups outside of a certain time frame.
PowerShell Script
I’m a massive fan of PowerShell and as is often the case it has a load of very handy commands related to DPM which we can make use of. I’m sure there are cleaner ways to do it but if you just want to remove old backups then the script below will do it for you.
Make sure to change the $backupDateCutoff value at the top to change how many days backups you want to retain. This script will loop through every Protection Group, pick out all of the backups and then create a list of all recovery points, it then goes through the list and removes any backups older than a certain age using a DPM command called ‘Remove-RecoveryPoint’ which cleanly removes the backup.
# How many days of backups we want to keep, 7 days by default $backupDateCutoff = (Get-date).AddDays(-7) # Get protection groups on current machine $protectionGroups = get-protectiongroup # Get all of the individual backups $backups = @() for($i=0; $i -lt $protectionGroups.length; $i++) { $backups += get-datasource($protectionGroups[$i]) } # Get every individual recovery point within the backups $recoveryPoints = @() for($i=0; $i -lt $backups.length; $i++) { $recoveryPoints += get-recoverypoint $backups[$i] } # Loop through every recovery point, remove if date is before the cutoff ForEach($recovery in $recoveryPoints) { if($recovery.BackupTime -le $backupDateCutoff) { Remove-RecoveryPoint -RecoveryPoint $recovery -Confirm:$false } } # Finally, disconnect from the DPM Server Disconnect-DPMServer