Veeam Backup & Replication allows you to perform staged restore — run an executable script for VMs before recovering them to the production environment.
Staged restore can help you ensure that recovered VMs do not contain any personal or sensitive data. For example, you can instruct Veeam Backup & Replication to run a Windows PowerShell script that removes Active Directory users:
$UserName = "John.Smith"
$ADUser = Get-ADUser -Filter 'Name -like $UserName'
Remove-ADUser -Identity $UserName -Confirm:$false
Stage restore is available only for entire VM restore operations. To perform staged restore, you must select the Staged Restore mode in the Full VM Restore wizard and specify staged restore settings.
Before you perform staged restore, check the following prerequisites:
- The staged restore functionality is available in the Enterprise and Enterprise Plus editions of Veeam Backup & Replication.
- You must have a preconfigured virtual lab in your backup infrastructure. For more information, see Virtual Lab.
- Scripts that you plan to run must reside in a local folder on a backup server.
- If you plan to perform staged restore for several VMs within one restore session, make sure these VMs run OS of the same type: either Microsoft Windows or Linux. In the current version of Veeam Backup & Replication, you cannot specify credentials and scripts for each VM individually.
How Staged Restore Works
For staged restore, Veeam Backup & Replication uses a preconfigured virtual lab, an executable script located on the backup server, and credentials to connect to VMs and run the script. Veeam Backup & Replication performs staged restore in the following way:
- In the virtual lab, Veeam Backup & Replication starts VMs directly from compressed and deduplicated backup files that reside in the backup repository. To achieve this, Veeam Backup & Replication uses Instant VM Recovery.
If you use an application group to run a script, Veeam Backup & Replication first starts VMs from the application group in the required order.
- Veeam Backup & Replication copies the script from the backup server to VMs that you plan to restore.
To connect to VMs, Veeam Backup & Replication uses credentials specified in staged restore settings.
- Veeam Backup & Replication runs the copied script on every VM.
To run the script, Veeam Backup & Replication uses the same technology as for pre-freeze and post-thaw scripts. For more information, see Pre-Freeze and Post-Thaw Scripts.
- Veeam Backup & Replication writes all VM changes that take place during script execution to the differencing disk (AVHD/AVHDX file).
Veeam Backup & Replication stores differencing disks on the Hyper-V host where the virtual lab is created.
- After the script execution is complete, Veeam Backup & Replication makes a safe shutdown of VMs in the virtual lab.
- Veeam Backup & Replication restores VMs in a changed state to the production environment.