Question

Powershell for PD schedules - changed in 5.5.2 ?


We've been using a Powershell script to create Protection Domains and add schedules for about a year now, and it's always worked fine but has started to fail this week, throwing a 500 error from the Add-NTNXProtectionDomainCronSchedule command.

The only thing we can think of that has changed is that we upgraded all of our clusters to AOS 5.5.2 over the last couple of weeks.

Has anything changed between 5.1.x and 5.5.2 which might affect this?

The Powershell script is very, very basic, in essence it just does:
Add-NTNXProtectionDomain -value $thispdname
Add-NTNXProtectionDomainVM -pdname $thispd -consistencygroupname $thiscg -Names $thisvm
Add-NTNXProtectionDomainCronSchedule -pdname $thispd -Type HOURLY -EveryNth 12 -UserStartTimeInUsecs $thissnap
Set-NTNXProtectionDomainRetentionPolicy -pdname $thispd -id $schedid -LocalMaxSnapshots 7

...with a tiny bit more error-checking. 🙂

As I say, it's worked for about a year and has just started to fail with a 500 Internal Server Error:
CategoryInfo : InvalidArgument: (Nutanix.Prism.Common.NutanixCluster:NutanixCluster) [Add-NTNXProtectionDomainCronSchedule], WebException
FullyQualifiedErrorId : {"message":"java.lang.NullPointerException"},Nutanix.Prism.PS.Cmds.Dr.AddProtectionDomainCronSchedule

3 replies

Userlevel 3
Badge +12
@jamiemcguffog Please try this

code:
$retention = New-NTNXObject -name RetentionPolicyDTO
$retention.localMaxSnapshots = 7

Add-NTNXProtectionDomainCronSchedule -PDname $thispd -Type HOURLY -EveryNth 12 -UserStartTimeInUsecs $thissnap -RetentionPolicy $retention
Thanks @Chandru, that works well for the local snapshot retention.

Is there an elegant solution for the remote sites piece?

I got it to work with
code:
 $retention = New-NTNXObject -name RetentionPolicyDTO
$retention.localMaxSnapshots = 7
$remote = New-Object 'system.collections.generic.dictionary[string,[System.Nullable[System.Int32]]]'
$remote.add("remotesitenamehere",3)
$retention.remotemaxsnapshots = $remote

Add-NTNXProtectionDomainCronSchedule -pdname $thispd -Type HOURLY -EveryNth 12 -UserStartTimeInUsecs $thissnap -RetentionPolicy $retention


..but it feels like there must be a more elegant solution.

Is it a documented change in 5.5.2, where the -RetentionPolicy parameter is now required for Add-NTNTProtectionDomainCronSchedule, where it was previously optional? Just trying to understand why it broke in the first place.
How can i set Parameter AppConsistentSnapshots on this way

$retention = New-NTNXObject -name RetentionPolicyDTO
$retention.AppConsistentSnapshots = true # ist not possible
$retention.appConsistent = true # not possible

what is the richt way for parameter AppConsistentSnapshots

Reply