Software Development Kit (SDK) and API Discussions

Powershell New-NcSnapMirrorPolicy

DWoodberry
1,591 Views

I am trying to recreate a snapmirror policy with schedule that I built out manually on a test cluster.  Cluster is running ONTAP 9.12 and my toolkit is 9.12.1.2302.

 

My issue is when I try to apply the schedule (Cron Job) to the policy. When using the gui to build everything, I have no issues.  Below is my syntax:
"New-NcSnapmirrorPolicy -Name 45DailyBackup -Type async -SnapmirrorLabel backup -VserverContext $cluster -CreateSnapshotOnSource $false -Keep 45 -TransferSchedule MAAG-Vault"

 The error I get is (Cannot bind parameter 'TransferSchedule'. Cannot convert the "MAAG-Vault" value of type "System.String" to type "DataONTAP.C.Types.SnapmirrorPolicy.TransferSchedule".)
I have tried to assign the "Trasnfer Schedule" as a variable to see if it would convert, but no luck. However, I can use the gui and assign this transfer schedule. I also made an attempt to also use Set-NcSnapmirrorPolicyRule and Add-NcSnapmirrorPolicyRule using my Policy name, but I get "no matching records". Any help would be great as I feel I am missing something simple. 

 

3 REPLIES 3

DWoodberry
1,554 Views

So I think I found a work around, but I also think there may be a bug in the toolkit. There is nothing that I found that can directly create an object of type "DataONTAP.C.Types.SnapmirrorPolicy.TransferSchedule"

 

$cronJobSched = Add-NcJobCronSchedule -Name MAAG-Vault -Hour 3 -Minute 0
$transferSched = [DataONTAP.C.Types.SnapmirrorPolicy.TransferSchedule]::new()
$transferSched.Name = $cronJobSched.JobScheduleName
$transferSched.Uuid = $cronJobSched.Uuid
New-NcSnapmirrorPolicy -Name 45DailyBackup -Type async -SnapmirrorLabel backup -VserverContext $cluster -CreateSnapshotOnSource $false -Keep 45 -TransferSchedule $transferSched

AmmarMhowwala
1,334 Views

This issue is not a bug; the specific parameter requires an object of type 'DataONTAP.C.Types.SnapmirrorPolicy.TransferSchedule.' We will raise a ticket to update the help documentation for this cmdlet, clarifying that the mentioned parameter expects a value of the specified object type.

DWoodberry
1,255 Views

Thank you. Would this include an easier way to created an object of this type instead of having to use the method I did above? 

Public