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="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/2003/dls/ScriptingConfig.xsd"> <DatasourceScriptConfig DataSourceName="Data source"> <PreBackupScript>”Path\Script Parameters” </PreBackupScript> <PostBackupScript>"Path\Script Parameters” </PostBackupScript> <TimeOut>30</TimeOut> </DatasourceScriptConfig> </ScriptConfiguration>
To specify pre-backup and post-backup scripts
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).
For each data source, complete the DatasourceScriptConfig element as follows:
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.
In the PreBackupScript tag, enter the path and script name.
In the PreBackupCommandLine tag, enter command-line parameters to be passed to the scripts, separated by spaces.
In the PostBackupScript tag, enter the path and script name.
In the PostBackupCommandLine tag, enter command-line parameters to be passed to the scripts, separated by spaces.
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.
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.