Adding Customization Scripts for Individual VMs in a Recovery Group

Updated

You can add a custom scripts to individual 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 Individual VMs in a Recovery Group

You can configure a custom script that runs on the source VM before failover operations for an individual VM.

  1. When you add a recovery group, in the Configure recovery group tool, go to the Override options tab.

  2. Move the Override replication options of virtual machines toggle key to the right.

  3. Under Replication configuration, beside a replication pair, click the action button, and then select Configure script > Pre-failover.

    The Configure pre-failover script dialog box appears.

  4. 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.

  5. Click Save.

Configuring Post-Failover Scripts for an Individual VM in a Recovery Group

You can configure a custom script that runs on the destination (recovery) VM after failover operations for an individual VM.

  1. When you add a recovery group, in the Configure recovery group tool, go to the Override options tab.

  2. Move the Override replication options of virtual machines toggle key to the right.

  3. Under Replication configuration, beside a replication pair, click the action button, and then select Configure script > Post-failover.

    The Configure post-failover script dialog box appears.

  4. 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.

  5. Click Save.

Configuring Pre-Failback Scripts for an Individual VM in a Recovery Group

You can configure a custom script that runs on the source VM before failback operations.

  1. When you add a recovery group, in the Configure recovery group tool, go to the Override options tab.

  2. Move the Override replication options of virtual machines toggle key to the right.

  3. Under Replication configuration, beside a replication pair, click the action button, and then select Configure script > Pre-failback.

    The Configure pre-failback script dialog box appears.

  4. 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.

  5. Click Save.

Configuring Post-Failback Scripts for an Individual VM in a Recovery Group

You can configure a custom script that runs on the source VM after a failback operation.

  1. When you add a recovery group, in the Configure recovery group tool, go to the Override options tab.

  2. Move the Override replication options of virtual machines toggle key to the right.

  3. Under Replication configuration, beside a replication pair, click the action button, and then select Configure script > Post-failback.

    The Configure post-failback script dialog box appears.

  4. 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.

  5. Click Save.