You can protect a virtual machine by replicating it to a remote SRM site.


Connect to the vCenter Server system that the SRM server is registered with.

Connect-VIServer -Server -User 'MyAdministratorUser' -Password 'MyPassword'

Establish a connection to the local SRM server by providing credentials to the remote SRM site.

$srm = Connect-SrmServer -RemoteUser 'MyRemoteUser' -RemotePassword 'MyRemotePassword'

List all protection groups associated with the SRM server.

$srmApi = $srm.ExtensionData
$protectionGroups = $srmApi.Protection.ListProtectionGroups()

Associate the TestVM virtual machine with the ProtGroup1 protection group and enable the protection for that virtual machine.

$vmToAdd = Get-VM "TestVM"

$targetProtectionGroup = $protectionGroups | where {$_.GetInfo().Name -eq "ProtGroup1" }


# Enable protection for that virtual machine
$protectionSpec = New-Object VMware.VimAutomation.Srm.Views.SrmProtectionGroupVmProtectionSpec
$protectionSpec.Vm = $vmToAdd.ExtensionData.MoRef
$protectTask = $targetProtectionGroup.ProtectVms($protectionSpec)
while(-not $protectTask.IsComplete()) { sleep -Seconds 1 }