You can add custom scripts to run on a dedicated VM during plan failover and test failover as a recovery step.

In the Script VM > Recovery Steps page of the recovery planwizard, you can configure either Recover steps in the following ways:
  • Recovery Steps > Step Type > Recover Protection Groups | Individual VMs | All remaining VMs, files and groups > Pre/Post-recover actions for each VM > Run script in the Script VM. These recovery step types allow you to execute a script on the script VM once per-recovered VM. You can configure each recover step to be run on the script VM before and/or after failover or failback operations.
  • Recovery Steps > Step Type > Other Actions > Add Action > Run script in the Script VM. This recovery step executes a script on the script VM once, and can be placed before, in-between, or after other recovery steps. You can also add multiple other actions to run a script in a single recovery plan. For example, you can add one recover step action to launch a script before recovery is performed, in the middle of the VMs being recovered, and then another script launch after the VMs are recovered.
Note: You cannot use a script VM during ransomware recovery.

For more information on script VMs and recovery steps, see Recovery Steps.

Any script must be accessible to the script VM, since script execution is performed on the script VM.

Both Windows (Powershell) and Linux (Python) are supported for the script VM guest OS. You can use a script VM for testing and for real recovery operations.

Script VM restrictions:

  • A recovery plan only runs on a single script VM.
  • Scripts are run on the VM that you designate as the Script VM. Scripts are not run on other recovered VMs.
  • VMware Tools must be installed and running on the script VM.
  • The script VM must be available in the environment before the first step requiring a script call. The Script VM can be recovered as the first steps of a plan, or it must already running on the target recovery SDDC. For example, do one of the following:
    • Deploy the script VM on both the protected site and the recovery SDDC. The script is called from both locations during failover and failback. Or,

      Deploy the script VM on the protected site and add it to a protection group. Then, the script VM must be failed over as part of the recovery plan, and it needs a separate recovery step where the script VM is recovered before other VMs are recovered.

Note: A script VM configured to run on multiple VMs is run sequentially on each target VM in the batch. Depending on the number of VMs targeted by the script VM, it can take longer by slowing the recovery completion process.

Procedure

  1. From the Recovery Plan > Script VM page, select the Run script VM option.
  2. Enter the VM name on which the script is run and the vCenter where the VM is hosted. You can select to run the same script for both real and test failovers, or you can use different scripts for real failovers and test failovers.
  3. Click Next in the recovery plan Wizard.
  4. On the Recovery steps page, click Add step.
  5. In the Add step dialog box, you can choose either one of the Recover steps, or Other.
    • Select Other Actions > Add Action > Run script in the Script VM to run a script on the script VM once, and can be placed before, in-between, or after other recovery steps. Or:
    • Select Recover Steps > Step Type > Recover Protection Groups | Invidual VMs | All remaining VMs, files and groups > Pre/Post-recover actions for each VM > Run script in the Script VM execute a script on the script VM once per-recovered VM.
  6. When you are finished, click OK.