VMware Cloud Community
shravang
Contributor
Contributor
Jump to solution

SRM APIs: How to call CreateAbrProtectionGroup using PowerCLI

Anyone who has used CreateAbrProtectionGroup API to create a new protection group?

What are the arguments to be passed to this method? The API doc says the arguments include the moref to the protection folder and the name of the protection group.

However, I see the below error on specifying these arguments:

$pgmoref=$srmApi.Protection.CreateAbrProtectionGroup("Folder-group-v22", "Group02")

Cannot find an overload for "CreateAbrProtectionGroup" and the argument count:

"2".

At line:1 char:53

+ $pgmoref=$srmApi.Protection.CreateAbrProtectionGroup <<<< ("Folder-group-v22"

, "Group02")

    + CategoryInfo          : NotSpecified: (:) [], MethodException

    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

Tags (1)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

According to the API Reference there are 4 parameters for the CreateAbrProtectionGroup method.


createabrprotectiongroup.png

And I suspect you will to provide a MoRef object instead of a String for the parameters indicated as MoRef.

$folder.ExtensionData.MoRef


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

3 Replies
LucD
Leadership
Leadership
Jump to solution

According to the API Reference there are 4 parameters for the CreateAbrProtectionGroup method.


createabrprotectiongroup.png

And I suspect you will to provide a MoRef object instead of a String for the parameters indicated as MoRef.

$folder.ExtensionData.MoRef


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

shravang
Contributor
Contributor
Jump to solution

Yes, I had missed the other parameter.

Here's how I've specified it now, and it works-

$DSMoref = $srmApi.Protection.ListReplicatedDatastores()[0].moref

$folderMoref = $srmApi.Protection.GetProtectionGroupRootFolder().moref

$ProtectionGroupMoref = $srmApi.Protection.CreateAbrProtectionGroup($folderMoref, $ProtectionGroupName, $ProtectionGroupDescriotion, $DSMoref)

This creates the new protection group.

Thanks,

Shravan

prasenjitchetia
Contributor
Contributor
Jump to solution

Maybe use "ListUnassignedReplicatedDatastores" to create new protection groups.

0 Kudos