How to get details like site information of a Recovery Plan programmatically ?

I want to get information about recovery plan and protection group like protected site, recovery site etc by using SRM API . I am not able to get this information. So how to get this information programmatically.

Thanks in advance.

0 Kudos
5 Replies
VMware Employee
VMware Employee

Hi Deepak,

You should find the details here:

Hope this helps!


SRM Docs


0 Kudos

I have gone through this . but according to this doc what we can get related to any Recovery Plan is only its name, description, status and same for PG. not the details like which is the protected site, recovery site etc. Can you point me to how we can get these details or getting this details is not at all possible ?

0 Kudos


I think you are looking for the "state" attribute of the RecoveryPlanInfo you get back with the method getInfo() on a RecoveryPlan:

Enum - SrmRecoveryPlanRecoveryState

Property of

SrmRecoveryPlanInfo, SrmRecoveryPlanPeer

Enum Description

Enum Constants


cancelling      The recovery plan is in the process of cancelling.

error      The recovery plan has errors.

failedOver      The recovery plan has failed over.

needsCleanup      Need to cleanup a test run.

needsFailover      Need to re-run failover.

needsReprotect      Need to re-run reprotect.

needsRollback      Need to re-run rollback.

prompting      The recovery plan is running, but requires user-interaction before it may continue.

protecting      The recovery plan is protecting to the remote site, please run the peer recovery plan on the remote site.

ready      The recovery plan is not in a running state and may be run.

running      The recovery plan is currently running.

If the state is protecting, you are on the protection site. If it is "ready", you are on the recovery site. With the getPeer() method of a RecoveryPlan you can find the corresponding other.

I once put together a powershell script that does some ProtectionGroup reporting with SRM, shouldn't be to hard to adjust it to your needs:

$Server  = "mysrmserver.lab.local"
$UserName = "lab\administrator"
$Password = "apassword"
  [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
  Write-Host "Connecting to SRM"
  $webSvc = New-WebServiceProxy ("https://" + $Server + ":8095/srm-Service?wsdl") -Namespace SRM
      $srm = New-Object SRM.SrmService
      $srm.Url = "Https://" + $Server + ":9007"
      $srm.Timeout = 600000
      $srm.CookieContainer = New-Object System.Net.CookieContainer
      $srmSvcRef = New-Object SRM.ManagedObjectReference
      $srmSvcRef.Type = "SrmServiceInstance"
      $srmSvcRef.Value = $srmSvcRef.Type
      $srmSvcContent = $srm.RetrieveContent($srmSvcRef)
      Write-Host "Looging in to SRM"
      $srm.SrmLoginLocale($srmSvcRef, $UserName, $Password, $null)
      $srmObject = New-Object System.Object
      $srmObject | Add-Member -Type NoteProperty -value $Server -Name SRMServer
      $srmObject | Add-Member -Type NoteProperty -value $srm -Name SRMService
      $srmObject | Add-Member -Type NoteProperty -value $srmSvcContent -Name SRMContent
     $protectionGroupList = @();
     #Get Information about the ProtectionGroups and combine them
     ForEach ($protectionGroup in $SrmObject.SRMService.ListProtectionGroups($SrmObject.SRMContent.Protection)) {
        Write-Host "Fetching ProtectionGroupInfo"
        $protectionGroupInfo = $SrmObject.SRMService.GetInfo($protectionGroup)
        Write-Host "Fetching VMs for ProtectionGroup"
        $protectedVms = $SrmObject.SRMService.listProtectedVms($protectionGroup)
        $customProtectionGroupInfo = New-Object System.Object
        $customProtectionGroupInfo | Add-Member -Name ProtectionGroupMoRef -Value $protectionGroup -MemberType NoteProperty -PassThru
        $customProtectionGroupInfo | Add-Member -Name ProtectionGroupInfo -Value $protectionGroupInfo -MemberType NoteProperty -PassThru
        $customProtectionGroupInfo | Add-Member -Name ProtectedVms -Value $protectedVms -MemberType NoteProperty -PassThru
        $protectionGroupList += $customProtectionGroupInfo
      Write-Host "=== Results ==="
      Write-Host "-----"
      ForEach ($pg in $protectionGroupList)  {
        Write-Host "ProtectionGroup Name: " $
        Write-Host "Description De: " $pg.protectionGroupInfo.description
        Write-Host "Replication Type: " $pg.protectionGroupInfo.type
        ForEach ($vm in $pg.protectedVms) {
           Write-Host "    VM MoId: " $vm.vm.value
           Write-Host "    Protection State: " $vm.state
           Write-Host "    Peer State: " $vm.peerState
           Write-Host "    needs configuration: " $vm.needsConfiguration
           Write-Host "    ----"
         Write-Host "---"



0 Kudos

Thanks Joerg for your reply.

Actually I want to know what is the protected site and recovery site related to any Recovery Plan or Protection Group programmatically.

This information is shown on summary page of Recovery Plan or Protection Group in SRM UI. So same information i want to get programmatically.


0 Kudos

For a ProtectionGroup you can use the getPeer()-method, an then examine the "state" attribute of the ProtectionGroupPeer.

There you can see for instance if it's ready, or "shadowing".

A consolidated information like in the summary page I haven't found in the API :-(.

You should file a feature request for that.



0 Kudos