VMware Cloud Community
prusac
Contributor
Contributor

SRM specifies the recovery options

Is it possible to not replicate recent changes during starting recovery plan from PowerCLI?

As per documentation in VMware SRM API v6.5 there is optional parameter "RecoveryOptions":

---------------------------

Synopsis from "Site Recovery Manager API Developer's Guide, Site Recovery Manager 6.5, page 63"

Startvoid start(RecoveryPlan.RecoveryMode mode, @version5 @optional RecoveryOptions options)

---------------------------

But when I connect to SRM and execute:

$srmapi.recovery.ListPlans() | gm

I get

Start      Method               void Start(VMware.VimAutomation.Srm.Views.SrmRecoveryPlanRecoveryMode mode)

There is no optional parameter which is described in SRM API.

Do I have to use PowerCLI version 6.5 to utilize this optional parameter.

Thank you for assistance

Reply
0 Kudos
3 Replies
admin
Immortal
Immortal

This new SRM public API option is exposed in PowerCLI 6.5.1. If you have a reference to the recovery plan object in PowerCLI, e.g. `$plan` then you can call the correct method with the new option provided. The two methods on the Recovery Plan object to start the recovery are:

void Start(VMware.VimAutomation.Srm.Views.SrmRecoveryPlanRecoveryMode mode)

void Start(VMware.VimAutomation.Srm.Views.SrmRecoveryPlanRecoveryMode mode, VMware.VimAutomation.Srm.Views.SrmRecoveryOptions options)

The second one provides the new option to either sync (or not) the data. It looks like you can set the option not to sync the data by creating the SRM Recovery options object as follows:

$RecoveryOption = New-Object VMware.VimAutomation.Srm.Views.SrmRecoveryOptions

$RecoveryOption.SyncData = $false

And then pass it to the appropriate version of the start method.

Reply
0 Kudos
TusharVaghode
Contributor
Contributor

I had been looking for this option. However didn't work for me using PowerCLI 6.5.1.

SRM Version is: 6.1.1.

Wondering if I have to upgrade SRM as well?

PowerCLI C:\> $RecoveryOption = New-Object VMware.VimAutomation.Srm.Views.SrmRecoveryOptions

New-Object : Cannot find type [VMware.VimAutomation.Srm.Views.SrmRecoveryOptions]: verify that the assembly containing this type is loaded.

At line:1 char:19

+ ... eryOption = New-Object VMware.VimAutomation.Srm.Views.SrmRecoveryOpti ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException

+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Reply
0 Kudos
admin
Immortal
Immortal

Yes, I believe this API was updated in SRM 6.5 to add this option, so I don't believe it will work with SRM 6.1 unfortunately.

In terms of the PowerCLI error though please check that you are using PowerCLI 6.5.1 (released in April 2017), not PowerCLI 6.5 R1 (released in November 2016). With the repackaging of PowerCLI to deliver it via the PowerShell Gallery the version number format was updated.

Reply
0 Kudos