Skip to end of metadata
Go to start of metadata

If you've purchased a Macrium Reflect Deployment Kit License then to assist with deploying images it may be desirable to automate the restore of a 'Golden' Image by adding the Macrium Reflect auto restore xml file directly to the Windows Image (WIM) file used by the rescue media or by a PXE deployment server. 



Create your auto restore XML using your 'Golden' image by simulating a restore and pressing 'Ctrl' + 'Shift' + 'S' on the final restore wizard page as describe below:

Note: The steps below to create the 'Golden' Image and 'macrium_restore.xml' can be run in Windows PE if required.
Ensure that the Image file is located on an accessible network share if you intend to deploy using PXE 

 Click here to show the Auto Restore dialog...

To launch this dialog press the 'Ctrl + Shift + S' together in the last page of the restore Wizard.


This dialog will prompt for options to automatically restore the selected image file at a later time using the Windows PE rescue media. When 'OK' is clicked a restore definition xml file will be saved.

OptionDescription
Password:Enter a password to protect against accidental or unauthorised running of this restore.
Source Image File:

Restore this image file: This is the default operation. The image file selected will be used as the restore source.

Restore the latest matching image in the same folder: The image folder will be searched for any image files that contain the partitions being restored. The latest backup date is chosen as the restore source.

Target Disk Selection:

Match target disk on unique identifier: This is the default operation. The unique disk id is used to ensure that the correct disk is restored to.

Match target disk on disk number if unique id is not found: This option will not fail the restore if the target unique disk id cannot be found.
The default number is the current number of the target disk but you can choose an alternative disk number if it's known that the number of the disk is different in the restore environment.

Use with caution as Windows PE can enumerate disks in a different sequence and cause the wrong disk to be restored to, however, this won't be an issue if your system has only one local disk.

Restore xml file location

Choose drive: Select from a list of local drives to save the restore definition file. The file will be saved in the root folder of the chosen drive and will be named 'macrium_restore.xml'

Choose a file name and location: If selected, a file 'save As' dialog will be shown when the 'OK' button on this dialog is clicked. This enables saving the restore definition file to any file name and to any folder.

Note: For auto restore to operate the restore definition must be named 'macrium_restore.xml' and be located on a root folder on a local drive. Saving to a different name and/or location enables you to prepare several restore definitions for later use.


Set the restore xml file as 'Read Only':
At the end of an auto restore the restore definition is automatically deleted. Setting the definition as 'Read Only' prevents deletion and enables re-running of the same restore each time Windows PE starts.


If the image file is located on a network share then you'll be prompted to enter the authentication details:



How auto restore works

Local drives are scanned (from A to Z) for a restore definition 'macrium_restore.xml' file in each drive root folder. Macrium Reflect will use the first restore definition found. This can be any local drive, including USB flash drives or optical media.

The restore definition contains instructions to locate the image file to restore from and the target disk to restore to. 

It is imperative that the correct image file is restored to the intended disk. To ensure that there are no nasty surprises after restoring, Macrium Reflect will uses unique disk identifiers and sector offsets to match the source and target of the restore. 


Locating the source image file folder

The default behaviour is to read the image file specified in the <file_name> xml node. However, It's possible that Windows PE has assigned different drive letters to local drives, in this case the following procedure is followed.

  • All local drives are scanned for a 'Marker' file that is created when the restore definition is saved. This Marker file has the following file name format: 'Macrium_restore_{GUID}.txt', where the GUID (Globally Unique Identifier) is retrieved from the '<search node>' in the restore xml.

    <search guid="{0D6B46C4-A5ED-4578-A9C0-5539B0AB94A0}">Y</search>
    
    <file_name>D:\backups\auto_restore\4E855CB463979BC9-01-01.mrimg</file_name>


    If the marker file isn't found in the path specified in the <file_name> xml node then all local drives are searched for the marker file in the same sub folder.  If the marker file is found then that folder will be searched for the image file to restore. 

  • If no Marker file is found or is not specified in the xml then all local drive are scanned (from A to Z) to locate any images in the folder specified by the '<file_name>' xml node that contain images to restore. 

Note: If the image file is located on a network path then no searching is required. Network paths are unambiguous and absolute.

Locating the correct source image file

The default behaviour is to read the specified image file in the folder in the '<image_file>' xml node. However, if 'Restore the latest matching image in the same folder' is selected in the Auto Restore dialog then the following procedure is followed:

xml attribute find_recent="Y" is added to the <file_name> xml node.

<file_name find_recent="Y">D:\backups\auto_restore\4E855CB463979BC9-01-01.mrimg</file_name>


All matching backup sets are loaded in the image file folder and the most recent backup date is selected and used for the restore.  A matching backup set has the same disk and partitions specified in the restore definition file.

<restore_definition>
    <properties>
        <source_disk id="3A177438-02D6-4DB6-9FCC-184F81DEE52A">1</source_disk>
    </properties>

    <operation id="1">
    <type>copy</type>
    <copy>
        <source>
            <partition start_sector="2048" end_sector="616447">1</partition>
        </source>
    </copy>
    </operation>

</restore_definition>


A matching image file contains the same disk identifier and partiton start and end sectors as well as partiton number. 

e.g,  In this case Disk identifier 3A177438-02D6-4DB6-9FCC-184F81DEE52A and partiton number 1 with start sector 2048 and end sector 616447


Locating the restore target disk

The default behaviour is to select the target disk by matching the unique disk identifier specified in the <target_disk> xml node. However, if 'Match target disk number if unique id not found' is selected in the Auto Restore dialog then the following procedure is followed:

xml attribute number_fallback="Y" is added to the <target_disk>  xml node. 

<target_disk id="3A177438-02D6-4DB6-9FCC-184F81DEE52A" number_fallback="Y">1</target_disk>

The restore target disk is matched on disk number if a disk cannot be matched using the unique identifier. 

Please use this option with caution as Windows PE may load disks in a different sequence to regular Windows. This may cause the wrong disk to be restored to.




Next we need to mount the Windows Image (WIM) file and copy the 'macrium_restore.xml' file to the root of the image.

  1. From within Windows (not PE), create an empty folder anywhere on your C: drive that will be used to mount the WIM file.  In this example we'll use 'C:\Boot\Mount'.

  2. Open a command prompt with elevated privileges and type the following command:

    DISM /Mount-image /imagefile:C:\boot\macrium\WA10KFiles\media\sources\boot.wim  /index:1  /MountDir:"c:\boot\mount"
    Note: The location of the WIM in this case is the default location for the Windows PE 10 WIM file. Please update as necessary in your own command.
  3. Open the mounted folder in Windows Explorer and copy the 'macrium_restore.xml' file to the root.



    Note: After copying the file close Windows Explorer so that there are no locks on the open folder.
  4. Type the following commands in the command prompt:

    Dism /Unmount-image /MountDir:"c:\boot\mount" /Commit
    Dism /Cleanup-Wim
  5. Once complete the WIM file can be copied to a deployment server or USB stick and used to initiate an automatic restore. 



  • No labels