The easy way to delete Windows Server 2012 backups
We’ve noticed a little bit lately that people are using Windows Server 2012 backups (and later operating systems). One issue we see people running into is the backup hard drive filling up and Windows Server Backup not deleting older backups as expected.
The thing is that some users (including System Administrators) aren’t able to resolve the issue. This is why we’re going to show you how to delete Windows Server 2012 backups easy below.
A bit of background on Windows Server Backup
Windows Server Backup was first introduced to the world within Windows Vista and also Windows Server 2008. However the options available with this were very limited (including manual space management options); which gave Windows Backup a bit of a (and definitely justified) bad reputation among the IT community. Unfortunately it’s a reputation that still holds today; even though the improvements have been vast from Server 2012 onwards.
How to delete Windows Server 2012 backups through command line
As we mentioned; it’s quite easy to delete previous backup versions using Windows Backup on Server 2012 and newer operating systems.
Note: In case it’s not obvious; these commands aren’t able to be run on Server 2008 or Server 2008 R2 as the packaged version of Windows Server Backup doesn’t support them.
Firstly; you’ll need to open an elevated command prompt (you know the ones, where you ‘run as Administrator’?).
Now all you’ll need to do is select one of the following types of delete commands offered in Windows Server Backup and run it.
Command Line Option 1
WBADMIN DELETE BACKUP -version:03/31/2006-10:00
This particular command requires you to know the date and time of the backup which you’re wanting to delete. You can get this information by running wbadmin get versions; but since it only allows for one single, specific backup to be deleted each time – it doesn’t really help when the drive is full.
Command Line Option 2
WBADMIN DELETE BACKUP -keepVersions:3 -backupTarget:f:
One of our favourites here at Test My Backups. The command above once run will delete all backups except for the last three on the F: drive. Obviously the ‘3’ and ‘f:’ portions of the example above are variables which you can change to suite your environment.
Very powerful if wanting to remove a number of backups quickly!
Command Line Option 3
WBADMIN DELETE BACKUP -backupTarget:f: -deleteOldest
This is particularly the best command line to use to help avoid your backup drive filling up. We use it with batch files so that it automates the space management task. This will find the oldest backup on the F: drive (as mentioned earlier; the drive letter should be changed to the drive letter used by your backup drive).
Hopefully this information helps anyone struggling to delete Windows Server 2012 backups from their backup drive.
For more information and command line syntax usage for Windows Server Backup; you can view the Windows Backup help files.