Search Posts

Wbadmin Delete Backup for Windows Server

Wbadmin Delete Backup for Windows Server 2016/2012/2008

Do you need to delete old backups?

According to Microsoft, Windows Server Backup (WBS) runs an automatic disk usage management to remove previous versions of backup to make room for the next backup. Seemingly, you don’t need to manually delete backups by running Wbadmin delete backup command because WBS is supposed to do it for you. Nevertheless, you will still have a backup failure for the backup disk is full after a running scheduled backups a couple of times. The truth is, WBS will stop automatically deleting old backups when WSB can no longer track the space allocated for snapshot. As you know, backups created by WSB cannot be deleted in File Explorer. To free up more space for new backups, you can use WBadmin command to delete old backups from the command prompt.

How to delete old backups?

There are basically two types of backups that WSB creates, system state backups and non-system state backups. You can use different command parameters to get rid of them. To use Wbadmin command, you need to open an elevated command prompt. You can right click on Start and select Command Prompt (Admin).

Delete system state backup

A system state backup is kept in an independent directory. Wbadmin provides 3 ways to specify the backups by using different parameters, [-version] to delete specific version(s), [-keepVersions] to delete all backups but the specified ones, or [-deleteOldest] to delete the oldest backup. For example: to delete the system backup that was taken on May the fourth evening at18:25, just run the following command in a command prompt:

Wbadmin delete systemstatebackup -version: 05/04/2015-18:25 -backupTarget: G:

Delete non-system state backup

If your server is running Windows Server 2012/2012R2 or Windows Server 2016, you can run delete backup command to remove backups as you wish. You can specify the backups you want to delete by using one, and only one, of the following parameters: -keepVersions, -version, or -deleteOldest. For example, to delete all backups except one backup version 11/10/2015-06:48, run the Wbadmin keepversions command below:

Wbadmin delete backup -keepVersion:11/10/2015-06:48 -BackupTarget:F:machine:WIN-9814GD4FH95

The parameter “-machine:” is only needed when you have backed up many computers to the same location.

In Windows Server 2008R2 or previous versions of Windows Server, WBS will not allow you to directly delete non-system state backups. As a workaround, you can delete the corresponding shadow copy on the backup target location.

To delete shadow copy:

1. Type: “DiskShadow.exe” in an elevated command prompt and press Enter.

2. Type the command: “delete shadows oldest G:” The parameter “G” has to be replaced with your backup drive letter or volume GUID. Delete Shadow

Generally, the backup drive has no drive letter. In that case, to use Wbadmin to delete full volume backup, you may need to manually assign a drive letter to the backup drive or run the command:”Mountvol” to learn the volume GUID. As a backup program, WSB works in some ways, but it still has a long way to be perfect. Instead of worrying about the scheduled backup will fail sometime, you can switch to another more dedicated backup software.