When Macrium Reflect takes an image, it invokes Volume Shadow Copy Service (VSS). This is a Microsoft component that takes a point-in-time snapshot. This snapshot remains active until the imaging completes. This creates a backup that results in a consistent restore.

SQL Server is a VSS-aware application. If you receive VSS errors related to SQL that you are unable to resolve you can create batch files for Macrium Reflect to run at the beginning and end of the snapshot that automatically stops then starts the MS SQL service.

Note: You can also use similar batch files to stop and start other services, such as MySQL that are not VSS aware.


This functionality is 'Off' by default and can be turned 'On' by creating the following registry entry:

Key:

HKEY_LOCAL_MACHINE\SOFTWARE\Macrium\Reflect\settings

Name:

EnablePrePostScripts

Type:

DWORD32

Value:

Off = 0, On = 1

Default:

0



To prevent unauthorized creation and modification of the batch files described in this article please see Macrium Reflect and best practices for file security


To disable the SQL server service for the duration of the snapshot:

  1. Find the name of the SQL Service that you want to stop:

    Start the Microsoft Service manager by running  'services.msc'
    Open the properties for the service and copy the service name:

    In this case, the service name is: MSSQL$SQLEXPRESS

  2. Create batch files in the same folder as the XML definition file
    You can type batch files as text using a program like Notepad before saving them with a .bat file extension.

  3. To determine the XML definition file folder, select the XML definition file and click the Open icon on the toolbar. 

     


  4. Format the names of the batch files so Macrium Reflect automatically uses them for the XML definition.  The batch files should be named as below:
    <definition file name>_before_snapshot_wait.bat

    <definition file name>_after_snapshot.bat

When the backup definition is executed the SQL Service stops just before to Macrium Reflect creates the volume snapshot then starts again a few seconds later after the snapshot is created.