Pre and Post backup scripts in DPM 2012 R2

Recently, I was faced with this issue in Data Protection Manager 2012R2 (CU2) of my client. So to resolve this last I have had three solutions for the work around:

  • Resize Recovery Partition
  • Move shadow copy storage from Recovery Partition to C: volume
  • Use Pre and Post backup script

Resize Recovery partition

The goal of the first solution is to resize the Recovery partition using the Diskpart tool to add 100MB:

It is possible to modify this partition when the computer is installed thanks to unattended file but it is not possible in my case when the computer is already installed (I can’t use a third tool to make the resizing of partitions). Because I have a lot of computers already installed, this solution is not good.

Move shadow copy storage

The goal of the second solution is to move the shadow copy storage from Recovery partition to C: partition. For that use the vssadmin command as below:

The volume with ID fd25aea8-4a3a-4b97-8c77-4e68f61a8d63 is the Recovery Partition. To move the shadow copy storage from this partition to C: volume, use this command:

vssadmin add shadowstorage /for=\\?\Volume{ fd25aea8-4a3a-4b97-8c77-4e68f61a8d63}\ /on=c: /maxsize=500MB

In my opinion, I won’t use this command because when a permanent fix will be released, I will have to change this setting again.

Use Pre and Post backup scripts in DPM 2012 R2

Data Protection Manager enables to run pre and post backup scripts. This (I hope) temporarily solution enables me to create two scripts:

  • One to run REagentc /disable (Pre-Backup script)
  • One to run REagentc /enable (Post-Backup script)

So I create two scripts called Disable-Reagentc.cmd and Enable-Reagentc.cmd that contains only the related command. These scripts must be located on the protected server. Next, modify the ScriptingConfig.xml located on protected servers. In standard installation, this XML file is located here:

C:\Program Files\Microsoft Data Protection Manager\DPM\Scripting\ScriptingConfig.xml

Modify the ScriptingConfig.xml as below:


<?xml version="1.0" encoding="utf-8"?>
<ScriptConfiguration xmlns:xsi=""
                     xmlns:xsd="" xmlns="">
   <DatasourceScriptConfig DataSourceName="System Protection ">
      <PreBackupScript>C:\Tools\ Disable-Reagentc.cmd</PreBackupScript>
      <PostBackupScript>C:\Tools\ Enable-Reagentc.cmd</PostBackupScript>

/!\ Make sure that only Administrators and LOCAL SYSTEM account can edit and run these scripts. When DPM run these scripts, it uses the LOCAL SYSTEM account. So if a malicious guy tries to attack your system, this is a good entry point.

Now that the XML is modified, make sure that DPMRA service is stop ped (net stop DPMRA). When it is done, perform a consistency check and that should be all right!

For more information about Pre and Post backup script I recommend you this link.

About Romain Serre

Romain Serre works in Lyon as a Senior Consultant. He is focused on Microsoft Technology, especially on Hyper-V, System Center, Storage, networking and Cloud OS technology as Microsoft Azure or Azure Stack. He is a MVP and he is certified Microsoft Certified Solution Expert (MCSE Server Infrastructure & Private Cloud), on Hyper-V and on Microsoft Azure (Implementing a Microsoft Azure Solution).


  1. Can i use dedicated network interface for backup with dpm?

  2. Hello,

    For my client, I try to use a dedicated network for backup. Currently it doesn’t work. When the solution will work, I will post a topic about that.

    The solution consists to create a second primary DNS zone and to configure the backup NIC with specific suffix (“example:”) and to register DNS with this specific suffix.

    Moreover I set DNS address on this NIC to use backup IP of DNS server.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Check Also

Monitor Data Protection Manager with SCOM

System Center Operation Manager (SCOM) is able to monitor Data Protection Manager. SCOM enables to ...

Use a dedicated network for Data Protection Manager

Make a backup consumes a lot of bandwidth especially when Bare-Metal protection is used. This ...

Restore a server with Bare-Metal Recovery protection in DPM 2012R2

Bare-Metal Recovery (BMR) enables you to make a full protection of a machine. Usually BMR ...