Script Sample - Set Azure Site Recovery (ASR) Prerequisite Services@20aman Aug 23, 2018
When you want to use Azure Site Recovery (ASR) either for Migration or for Disaster Recovery (DR), you will need to enable replication. Under the hood, this involves installation of the Mobility Services agent. This has few pre-requisites for some services to be enabled and set up appropriately.
In the last script sample, we saw how to check remote computers if these services are set correctly or not. That sample can be found here: Script Sample - Check Azure Site Recovery (ASR) Pre-requisites.
In this sample, we will see how to set these services correctly on the remote computers.
How it works
This script will query the remote computers and set the service status for the 3 ASR Required services. These 3 services are:
- Volume Shadow Copy(VSS)
- COM+ System Application(COMSysApp)
- Microsoft Distributed Transaction Coordinator Service (MSDTC)
The script will set the startup type of the services to "automatic" and will then "start" the service. It uses the below cmdlets to perform these actions.
Set-Service -name 'msdtc' -ComputerName $Computer -StartupType Automatic Start-Sleep -s 5 Get-Service -Name 'msdtc' -ComputerName $computer| Start-Service
The cmdlets to configure other two services is similar.
Location of the Script
You can find this script in GitHub at this location: Set-ASRPrerequisiteServivces.ps1 on GitHub