none
wbadmin delete backup - delete version but does not delete version in Explorer RRS feed

  • Question

  • Environment: Windows 2012 R2

    Hi,

    Perhaps someone can explain this for me . . .

    I am performing a BareMetal backup to a local volume on the server.

    I have a scheduled Bi-Weekly BareMetal backup. One hour before the backup, I run a maintenance task to keepVersion:2 so that only 2 versions of the BareMetal backup are kept.

    The next BareMetal backup which is run is successful. I open a PS session, run wbadmin get versions and it shows 3 BareMetal backups performed. 2 weeks later, the next maintenance scheduled task is run, it removes the oldest BareMetal backup and displays 2 BareMetal versions (wbadmin get versions). When I open Explorer, under WindowsImageBackup\<Servername>, it still shows the BareMetal backup version which was deleted. I.E. running wbadmin get versions shows 2 versions of the BM backup, but 3 versions exist in Explorer.

    As this continues, the BM's are deleted when running wbadmin get versions but the files are not being removed.

    If this continues without my checking it, I will eventually run out of disk space.

    Why aren't the files for the BM backup being deleted when my maintenance task (wbadmin DELETE BACKUP -keepversions:2) runs?

    Help!

    David


    Monday, July 1, 2019 1:00 PM

Answers

  • I decided to add an extra disk to my server.

    SYSTEMSTATEBACKUP is written to E-drive, BM written to F-drive.

    Running maintenance tasks now seems to work. When WBADMIN DELETE Backup runs, it only deletes versions from the F-drive. Similarly, WBADMIN DELETE SYSTEMSTATEBACKUP only deletes versions from the E-drive.

    Running the BM maintenance with -keepversions:0, all versions are deleted and also from the disk!

    Having both SystemState and BM backups to the same drive seems to be causing the problems when either maintenance tasks run.

    I guess at this point, I simply need to add another disk to each Domain Controller and separate the backups in order for the maintenance tasks to function properly. not exactly what I wanted, but it works!

    david

    Wednesday, July 3, 2019 12:34 PM

All replies

  • Hello David,

    This seems rather strange, how are you running your "maintenance task"? Is it a script in a scheduled task? Or some other automation?

    You might want to check the log from running your command.

    As Bare Metal Recovery (MBR) is part of the System State backup, have you tried using the following command instead?

    wbadmin delete systemstatebackup -keepversions:2

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, July 1, 2019 1:32 PM
  • Hi Leon,

    My "maintenance task" is a simple PS command "wbadmin DELETE BACKUP -keepversion:2 -quiet".

    We run a SystemState backup (using wbadmin scheduled task) every day and the bi-weekly BM backup.

    We require both for our DR plan.

    david

    Monday, July 1, 2019 1:48 PM
  • Try without using the -quiet parameter and configure the script to write the results to a log file, just to check what exactly is happening.

    My guess would be that it doesn’t have sufficient permissions to delete the files, the UAC might also be blocking.

    Easiest to test this is by going through the process manually.

    Try accessing the folder within the File Explorer with the same user that is used to run the PS maintenance script, then try to delete and check what happens.


    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, July 1, 2019 1:55 PM
  • I'll give it a try and get back to you tomorrow!

    Good tip!

    david

    Monday, July 1, 2019 2:17 PM
  • Hi,
    Just want to confirm the current situations.
    Please feel free to let us know if you need further assistance.
    Best Regards,
    Daniel

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, July 2, 2019 2:13 AM
    Moderator
  • Maybe it will help if I give you more details:

    Backups are to a local drive E:

    I am backing up just the SystemState every day with a scheduled task running as SYSTEM.

    WBADMIN START SYSTEMSTATEBACKUP -backupTarget:E: -quiet

    I am backing up a BM every two weeks with a scheduled task running as SYSTEM

    WBADMIN START BACKUP -backupTarget:E: -allcritical -systemstate -quiet

    Before the SystemState runs, I run a scheduled task as SYSTEM which keeps 6 versions

    WBADMIN DELETE SYSTEMSTATEBACKUP -keepVersions:6 -quiet

    Before the BareMetal backup, I run a scheduled task as SYSTEM which keeps 2 versions

    WBADMIN DELETE BACKUP -keepVersions:2 -quiet

    As mentioned in my description, when there are more than 2 Baremetal backups, the maintenance task keeps 2 of them when running WBADMIN GET VERSIONS. PRoblem is the backups are not being deleted from the disk.

    I opened a CMD session as SYSTEM and using RD, I was able to delete the folder of a BM backup.

    Tuesday, July 2, 2019 8:13 AM
  • It might be some issue with your scheduled task, how is it configured?

    Blog: https://thesystemcenterblog.com LinkedIn:

    Tuesday, July 2, 2019 9:08 AM
  • here's the Scheduled task to perform a BM backup:

    
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2019-05-23T02:15:42</Date>
        <Author>AUTHOR</Author>
      </RegistrationInfo>
      <Triggers>
        <CalendarTrigger>
          <StartBoundary>2019-05-31T04:00:00</StartBoundary>
          <Enabled>true</Enabled>
          <ScheduleByWeek>
            <DaysOfWeek>
              <Sunday />
            </DaysOfWeek>
            <WeeksInterval>2</WeeksInterval>
          </ScheduleByWeek>
        </CalendarTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>S-1-5-18</UserId>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
        <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>PT4H</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <Exec>
          <Command>WBADMIN</Command>
          <Arguments>START BACKUP -backuptarget:E: -allcritical -systemstate -quiet</Arguments>
        </Exec>
      </Actions>
    </Task>

    and here is the maintenance scheduled task:

    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2019-05-23T02:20:50.3139932</Date>
        <Author>AUTHOR</Author>
      </RegistrationInfo>
      <Triggers>
        <CalendarTrigger>
          <StartBoundary>2019-05-31T03:00:00</StartBoundary>
          <Enabled>true</Enabled>
          <ScheduleByWeek>
            <DaysOfWeek>
              <Sunday />
            </DaysOfWeek>
            <WeeksInterval>2</WeeksInterval>
          </ScheduleByWeek>
        </CalendarTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>S-1-5-18</UserId>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
        <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <Exec>
          <Command>WBADMIN.EXE</Command>
          <Arguments>DELETE BACKUP -keepversions:2 -quiet</Arguments>
        </Exec>
      </Actions>
    </Task>

    Tuesday, July 2, 2019 10:39 AM
  • If you trigger the Task Schedule manually, does it delete the files?

    Blog: https://thesystemcenterblog.com LinkedIn:

    Tuesday, July 2, 2019 3:16 PM
  • Manually triggering the scheduled task DOES NOT remove the folders.

    What I have discovered is that WBADMIN DELETE BACKUP not only deletes BM backups, but also deletes SystemState Backups.

    My original goal was to run SYSTEMSTATE backups every day and every 2 weeks a BM backup.

    Wednesday, July 3, 2019 7:25 AM
  • It seems like the scheduled task is not performing as it should, you could try creating the command in a batch script and try calling it instead.

    That's interesting, the wbadmin delete backup shouldn't delete systemstate backups unless specified to do so.

    How are you checking this?


    Blog: https://thesystemcenterblog.com LinkedIn:

    Wednesday, July 3, 2019 7:54 AM
  • I run WBADMIN GET VERSIONS, note how many and types of backups are listed.

    I have 6 SYSTEMSTATE backups and 3 BM backups listed.

    I then run the scheduled task which is nothing more than

    WBADMIN DELETE BACKUP -keepversions:2 -quiet as SYSTEM account.

    Running WBADMIN GET VERSIONS again, I only have 2 SYSTEMSTATE backups!

    Both SYSTEMSTATE and BM backups are run using the SYSTEM account.

    I don't see the point in creating a script which runs the same command.

    Wednesday, July 3, 2019 8:00 AM
  • I decided to add an extra disk to my server.

    SYSTEMSTATEBACKUP is written to E-drive, BM written to F-drive.

    Running maintenance tasks now seems to work. When WBADMIN DELETE Backup runs, it only deletes versions from the F-drive. Similarly, WBADMIN DELETE SYSTEMSTATEBACKUP only deletes versions from the E-drive.

    Running the BM maintenance with -keepversions:0, all versions are deleted and also from the disk!

    Having both SystemState and BM backups to the same drive seems to be causing the problems when either maintenance tasks run.

    I guess at this point, I simply need to add another disk to each Domain Controller and separate the backups in order for the maintenance tasks to function properly. not exactly what I wanted, but it works!

    david

    Wednesday, July 3, 2019 12:34 PM
  • From the current situation, this is a good workaround.

    Thanks for your sharing!

    Daniel


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, July 4, 2019 2:45 AM
    Moderator
  • Glad to hear you've found a workaround!

    Blog: https://thesystemcenterblog.com LinkedIn:

    Thursday, July 4, 2019 6:55 AM
  • Hi,

    Thought I'd give an update to my issue . . .

    I decided to have only one maintenance scheduled task to delete both SYSTEMSTATE and Bare Metal backups. I was running the following command:

    wbadmin DELETE BACKUP -BackupTarget:E: -keepversions:13 -quiet

    This command will remove both SS and BM backups from the list of different versions (running wbadmin get versions). HOWEVER, it will not delete the BM backups from the disk! It will remove SS backups from the disk, simply not BM backups.

    I have decided to try backing up BM to one drive and SS backups to a different drive and then use 2 scheduled tasks; 1 for SS, 1 for BM.

    IF anyone has a different solution . . . I am all ears!!!

    david

    Tuesday, July 30, 2019 9:31 AM