Adding Custom Scripts to Veeam Recovery Orchestrator
If you have a PowerShell script that you want to run as part of the recovery process, you can upload your script into Orchestrator, and it will be executed when you run your plan.
The script can run on a Veeam Backup & Replication server, on the Orchestrator server or inside each machine included in the plan. You can customize settings required for script execution and pass various parameters into the script: credentials, runtime variables (such as vm_name or plan_state) and any other custom parameters you require. Script output will be captured in plan details in the Orchestrator UI, and in Plan Execution and DataLab Test reports.
Due to Microsoft Azure limitations, script output for cloud plans is limited to 4 kB.
This section will demonstrate how to upload a simple example script into Orchestrator.
$fileName = "HelloWorld.txt"
"Hello World!" | Out-File -FilePath "$folderName\$fileName"
Write-Host "File $fileName was created in folder $folderName"
Write-Error "Failed to create file in folder $folderName"
If you want to create a custom script and execute it when running a recovery plan, you must take into account the following considerations.
- Running custom scripts inside guest OSes of Linux-based machines is not supported.
- The script you want to use must be a PowerShell script. Orchestrator 7.0 supports PowerShell scripts only.
- To allow the script to run inside a machine guest OS, it is required that you have Microsoft PowerShell 3.0 and .Net Framework 4.0 installed on each machine for which you enable the custom script step.
- To allow the script to run inside the guest OS of a machine recovered to Microsoft Azure, the compute account (Azure AD application) added to the Veeam Backup & Replication server configuration and used to access the Microsoft Azure resources must be assigned the Contributor and Key Vault Crypto User user roles. Alternatively, you can create a custom role on the Microsoft Azure portal with the following permissions assigned: Microsoft.Compute/virtualMachines/runCommands/read, Microsoft.Compute/virtualMachines/runCommands/write, Microsoft.Compute/virtualMachines/runCommands/delete.
For more information on creating custom roles, see the Veeam Backup & Replication User Guide, section Creating Custom Role for Azure and Azure Stack Hub Accounts.
- To allow the script to run on a Veeam Backup & Replication server, no additional software is required.
In This Section