Before and after executing a Failover, move or test Failover, you can run executable scripts, such as Windows bat files. The Post-recovery scripts that run after a Failover, move or test Failover, run after all the virtual machines have been powered on at the recovery site.
These scripts must be saved to the machine where the peer Zerto Virtual Manager is installed. If the site is masked, you cannot see or specify scripts in the VPG definition at the masked site, but the site that implements the masking can edit the VPG to add scripts.
It is recommended to duplicate scripts on the Zerto Virtual Managers for both the protected and recovery sites, so that if reverse replication is required, the scripts are available. The location of the scripts on both local and peer machines must be to the same. For example, if the scripts are saved to on the peer Zerto Virtual Manager machine, they must be saved to on the local Zerto Virtual Manager machine.
The scripts can include environment variables which can be included as part of the script itself, or passed to the script as parameters. When the script is passed an environment variable as a parameter, the variable is evaluated before executing the script. The following environment variables are available:
For example, if a specific VPG should not be migrated, the pre-recovery script can determine whether to continue based on the values of the %ZertoOperation% and %ZertoVPGName%.
When specifying scripts in the definition of a VPG, check the Use recovery scripts checkbox to display the script field - scripts can, however, be defined without being used.The following values are entered for the Pre-recovery Script and Post-recovery Script: