Share via

Using Pre-Backup and Post-Backup Scripts

Applies To: System Center Data Protection Manager 2007

A pre-backup script is a script that resides on the protected computer, is executed before each DPM backup job, and prepares the protected data source for backup.

A post-backup script is a script that runs after a DPM backup job to do any post-backup processing, such as bringing a virtual machine back online.

When you install a protection agent on a computer, a ScriptingConfig.xml file is added to the install path\Microsoft Data Protection Manager\DPM\Scripting folder on the protected computer. For each protected data source on the computer, you can specify a pre-backup script and a post-backup script in ScriptingConfig.xml.


The pre-backup and post-backup scripts cannot be VBScripts. Instead, you must user a wrapper command around your script containing cscript myscript.vbs.

When DPM runs a protection job, ScriptingConfig.xml on the protected computer is checked. If a pre-backup script is specified, DPM runs the script and then completes the job. If a post-backup script is specified, DPM completes the job and then runs the script.


Protection jobs include replica creation, express full backup, synchronization, and consistency check.

DPM runs the pre-backup and post-backup scripts by using the local system account. As a best practice, you should ensure that the scripts have Read and Execute permissions for the administrator and local system accounts only. This level of permissions helps to prevent unauthorized users from modifying the scripts.


<?xml version="1.0" encoding="utf-8"?>
<ScriptConfiguration xmlns:xsi="" 
   <DatasourceScriptConfig DataSourceName="Data source">
     <PreBackupScript>”Path\Script Parameters” </PreBackupScript>
     <PostBackupScript>"Path\Script Parameters” </PostBackupScript>

To specify pre-backup and post-backup scripts

  1. On the protected computer, open the ScriptingConfig.xml file in an XML or text editor.


    The DataSourceName attribute must be provided as Drive: (for example, D: if the data source is on the D drive).

  2. For each data source, complete the DatasourceScriptConfig element as follows:

    1. For the DataSourceName attribute, enter the data source volume (for file data sources) or name (for all other data sources). The data source name for application data should be in the form of Instance\Database for SQL, Storage group name for Exchange, Logical Path\Component Name for Virtual Server, and SharePoint Farm\SQL Server Name\SQL Instance Name\SharePoint Config DB for Windows SharePoint Services.

    2. In the PreBackupScript tag, enter the path and script name.

    3. In the PreBackupCommandLine tag, enter command-line parameters to be passed to the scripts, separated by spaces.

    4. In the PostBackupScript tag, enter the path and script name.

    5. In the PostBackupCommandLine tag, enter command-line parameters to be passed to the scripts, separated by spaces.

    6. In the TimeOut tag, enter the amount of time in minutes that DPM should wait after invoking a script before timing out and marking the script as failed.

  3. Save the ScriptingConfig.xml file.


DPM will suffix an additional Boolean (true/false) parameter to the post-backup script command, indicating the status of the DPM backup job.