Leverage Powershell to selectively eliminate VMs from backup archives
GDPR / DSGVO casts its shadow onto IT. On Friday 25th of May European privacy regulations will become effective and violations can result in very harmful penalties for enterprises.
In that context an unusual task was addressed to me today by a customer: “Delete all backups of VM KillMe (yes, all)!”
There are several strategies to fulfill the task:
Delete backups
Surely the worst of all methods. Yet ultimate but even non-affected VMs will be deleted from backups.
Set retention period of deleted objects to a minimum
In my opinion the second best method. You need to remove the VM in question from your backup-job. After the defined retention period all restorepoints will be deleted.
Job > Settings > Storage > Advanced > Maintenance
Set the checkbox at “Remove deleted items data after”. The value indicates days. Which means one day after removal of the VM from the job all of its restorepoints will be deleted. You have to wait at least one day to get rid of all restorepoints.
Powershell
That’s IMHO the most sophisticated method. Start a Powershell CLI from within Veeam Backup console. It then contains all necessary snap-ins.
With the Powershell CMDlet Remove-VBRRestorePoint it is possible to selectively remove restorepoints of single VMs from the backup-chain.
Jobname: Server_daily VM: KillMe
$backup = Get-VBRBackup -Name "Server_daily" $vm = Get-VBRRestorePoint -Backup $backup -Name "KillMe" Remove-VBRRestorePoint -Oib $vm
If you do not use the -Confirm false parameter there’ll be a security prompt.
You can confirm with A (Yes, all)
Veeam basically does the same when stetting the checkbox at retention period. The difference is, that you don’t have to wait another day (minimum value) and restorepoints will be deleted instantly. The process is quite fast and you can watch all backupfiles (VBK) and increments (VIB) being touched. They all get a current timestamp. The size if your backupfiles will not change except your repository has a per-VM backup file policy. In that case the files will be deleted and storage space is available again.