You can add a custom scripts to all VMs in a recovery group. Custom scripts can be configured for the following scenarios:
Pre-failover script: Runs on the source VM before failover.
Post-failover script: Runs on the destination (recovery) VM after failover.
Pre-failback script: Runs on the destination (recovery) VM before failback.
Post-failback script: Runs on the source VM after failback.
Pre-failover scripts run only before planned failovers. Pre-failover scripts do not run before unplanned failovers.
Before You Begin
Review the following information before configuring a pre or post script for the recovery group destination.
Required Components
To use pre or post scripts, you must have the following components configured:
Amazon: IAM role, SSM agent
Azure: Azure VM agent
VMware: Vmware Tools/Open VM tools
Supported Scripts
You can use the following scripts for each vendor:
Amazon
Windows: Powershell
Linux: Shell Scripts
Azure
Windows: Powershell
Linux: Shell Scripts
VMware
Windows: Batch Scripts
Linux: VM Guest options
Configuring Pre-Failover Scripts for all VMs in a Recovery Group
You can configure a custom script that runs on the source VM before all failover operations.
When you add a recovery group, in the Configure recovery group tool, go to the Target tab.
Under Customization scripts, configure custom scripts:
Beside Pre-failover, click the action
button, and then select Configure.
The Configure pre-failover script dialog box appears.
Enter the following information:
Path type: Enter the full UNC network path for the pre script, including the name of the script.
Path: Enter the location of the script file.
UNC Credentials: Enter credentials or use a set of saved credentials that have access to the UNC network:
Enter credentials: Select this option to manually enter the user name and password for the UNC network.
Username: Enter the user name for a user account that has permissions to access the network path for the script.
Password: Enter the password for the user account.
Use saved credentials: Select this option to use a set of credentials that were previously saved for the UNC network.
Credentials: Select a saved set of credentials.
Add button
: Click this button and then enter and save a set of credentials.
VM Guest Options: To use a VM Guest to access the script location, enter the following information:
User name: Enter the user name for a user account that has permissions to access the network path for the script.
Password: Enter the password for the user account.
Confirm password: Enter the same password.
Click Save.
Configuring Post-Failover Scripts for all VMs in a Recovery Group
You can configure a custom script that runs on the destination (recovery) VM after a failover operation.
When you add a recovery group, in the Configure recovery group tool, go to the Target tab.
Under Customization scripts, configure custom scripts:
Beside Post-failover, click the action
button, and then select Configure.
The Configure post-failover script dialog box appears.
Enter the following information:
Path: Enter the location of the script file.
UNC Credentials: Enter credentials or use a set of saved credentials that have access to the UNC network:
Enter credentials: Select this option to manually enter the user name and password for the UNC network.
Username: Enter the user name for a user account that has permissions to access the network path for the script.
Password: Enter the password for the user account.
Use saved credentials: Select this option to use a set of credentials that were previously saved for the UNC network.
Credentials: Select a saved set of credentials.
Add button
: Click this button and then enter and save a set of credentials.
Click Save.
Configuring Pre-Failback Scripts for all VMs in a Recovery Group
You can configure a custom script that runs on the source VM before a failback operation.
When you add a recovery group, in the Configure recovery group tool, go to the Target tab.
Under Customization scripts, configure custom scripts:
Beside Pre-failback, click the action
button, and then select Configure.
The Configure pre-failback script dialog box appears.
Enter the following information:
Path: Enter the location of the script file.
UNC Credentials: Enter credentials or use a set of saved credentials that have access to the UNC network:
Enter credentials: Select this option to manually enter the user name and password for the UNC network.
Username: Enter the user name for a user account that has permissions to access the network path for the script.
Password: Enter the password for the user account.
Use saved credentials: Select this option to use a set of credentials that were previously saved for the UNC network.
Credentials: Select a saved set of credentials.
Add button
: Click this button and then enter and save a set of credentials.
Click Save.
Configuring Post-Failback Scripts for a Recovery Group
You can configure a custom script that runs on the source VM after a failback operation.
When you add a recovery group, in the Configure recovery group tool, go to the Target tab.
Under Customization scripts, configure custom scripts:
Beside Post-failback, click the action
button, and then select Configure.
The Configure post-failback script dialog box appears.
Enter the following information:
Path type: Enter the full UNC network path for the pre script, including the name of the script.
Path: Enter the location of the script file.
UNC Credentials: Enter credentials or use a set of saved credentials that have access to the UNC network:
Enter credentials: Select this option to manually enter the user name and password for the UNC network.
Username: Enter the user name for a user account that has permissions to access the network path for the script.
Password: Enter the password for the user account.
Use saved credentials: Select this option to use a set of credentials that were previously saved for the UNC network.
Credentials: Select a saved set of credentials.
Add button
: Click this button and then enter and save a set of credentials.
VM Guest Options: To use a VM Guest to access the script location, enter the following information:
User name: Enter the user name for a user account that has permissions to access the network path for the script.
Password: Enter the password for the user account.
Confirm password: Enter the same password.
Click Save.