Knowledgebase

v5: Using VBScript to delete Differential Backups

Expand / Collapse
 

v5: Using VBScript to delete Differential Backups



This article shows you how to use VBScript to delete differential Images in a backup set.  This enables you to retain a specified number of recent differential Images, this tutorial also applies to differential file and folder backups.


In the following example we will generate a VBScript source file that creates a differential backup (Image or file and folder) and then delete differentials in the same set retaining the '4' most recent differential images.

*** Note: You should only run this script on *differential* backup sets ***.


1.  Generate VBScript file

Select 'Backup Definition Files' tab, then Right click on your Backup Definition File,and select 'Generate a VBScript File'.

2.  VBScript Defaults

In the next dialog accept the defaults and click on 'OK', although you can make the File Name more descriptive of the drives/folders being backed up if needed.

3. Prepare to edit VBScript in Notepad

Select the VBScript tab, right click on the new VBScriptlist entry and select 'Edit'. Notepad will open.

4.  Edit the File in Notepad

It is strongly suggested you do not select Word Wrap inNotepad, it is easier to edit without selecting Word Wrap


All the following code in Green will need to be copied to Notepad as per the instructions given:

After the line:
ExitCode = Backup ("""C:\Program Files\Macrium\Reflect\Reflect.exe"" -e -w <BACKUP_TYPE> ""PATH TO XML file""")

Copy and paste the following code:

Note: The number '4' above is the number of recent differential files you want to keep in the backup set, you can change this number

Example of Paste as indicated in following dialog:


At the very *end* of the file in notepad copy and paste the following code:

5. Save and review VBScript
Save the file in notepad: File > Save and close notepad. 

You can run VBScript files just like XML filesand you can schedule the VBScript file to run by right clicking on the VBScript file:  Select 'Run Now' or 'Schedule' (more detail in step 6 if needed). If you have previously scheduled XML files running the Differential, this XML scheduling can now be deleted if it is to be replaced by the scheduled VBScript file; make sure you only delete an XML file under the Scheduled Backups tab and not under the Backup Definition Files tab.



6.  How to run VBScript files on an 'ad hoc' basis and when Scheduled

If you want to run backups while retaining a limited number of Differentials you must nowrun the VBScript and not XML definition files. The following two examples aim to get you started with this.

6a.  To run a single ('ad hoc') Differential backup:

Select the 'VBScript Files' tab and right click the VBScript file name, you wish to run, and fromthe 'Run Now' option select Differential. The Differential backup should now run:

6b. To Schedule a VBScript file to run daily, weekly or monthly at a day and time you choose:

  1. Select the 'VBScript Files' tab and right click the VBScript file name, you wish to schedule, and select 'Schedule'
  2. In the next dialog seen, make sure you only select Differential for your VBScript backup. The password which you may need to enter is your normal Windows login in password, the 'Task Name' should be a description of the partitions being backed up. Then click on 'Next'.
  3. The next dialog asks when you would like the backup to be scheduled: daily, weekly, monthly etc. to select which days the differentials should run select 'Weekly'. Click 'Next'.
  4. To set the controls to ensure that the backup is run every week at 1800 hours set 'Every 1 week'  and 18:00. In this demonstration it runs 6 days a week, the checkbox at the botton entitled 'If missed then run at start-up' was also selected. The Start date will be the current date unless you change it. Click 'Next'.
  5. A summary of the details is shown. Click 'Finish'

You will note that the details of this task have been addedto the main pain of the application under the 'Scheduled Backups' tab.

*** Remember: You should only run this script on *differential* backups***.


Search Terms
How do I delete differential images
Keep recent differentials





.

Details
Last Modified:Sunday, February 10, 2013

Last Modified By: Administrator

Type: Tutorial

Level: Intermediate

Article not rated yet.

Article has been viewed 3,374 times.

Options