Hi Jim,
The API is "volume-set-snaplock-attrs" which relates to the "Set-NcSnaplockVolAttr" cmdlet. EG
Set-NcSnaplockVolAttr -Volume locked -MaximumRetentionPeriod "31 years" -VserverContext primary1
SYNTAX
Set-NcSnaplockVolAttr [-Volume] <String> [-MinimumRetentionPeriod <String>] [-DefaultRetentionPeriod <String>]
[-MaximumRetentionPeriod <String>] [-AutocommitPeriod <String>] [-VserverContext <String>] [-Controller
<NcController[]>] [-ZapiRetryCount <Int32>] [<CommonParameters>]
-MinimumRetentionPeriod <String>
Specifies the allowed minimum retention period for files to be committed to WORM state on the volume. Must be
specified as <number><suffix>. Valid suffixes are 'seconds', 'minutes', 'hours', 'days', and 'years'"
-MaximumRetentionPeriod <String>
Specifies the allowed minimum retention period for files to be committed to WORM state on the volume. Must be
specified as <number><suffix>. Valid suffixes are 'seconds', 'minutes', 'hours', 'days', and 'years'
The CLI process can be found here: https://library.netapp.com/ecm/ecm_download_file/ECMLP2507748
cluster1::> volume snaplock modify -vserver vs1 -volume vol1 -maximum-retention-period 10years
cluster1::> volume snaplock modify -vserver vs1 -volume vol1 -minimum-retention-period 365days
cluster1::> volume snaplock modify -vserver vs1 -volume vol1 -default-retention-period min
From a WFA perspective you'd need to create a command. For example:
#'------------------------------------------------------------------------------
Param(
[Parameter(Mandatory=$True, HelpMessage="The cluster name or IP Address")]
[String]$ClusterName,
[Parameter(Mandatory=$True, HelpMessage="The vserver name")]
[String]$VserverName,
[Parameter(Mandatory=$True, HelpMessage="The volume name")]
[String]$VolumeName,
[Parameter(Mandatory=$False, HelpMessage="The default retention period that will be applied to files when committed to WORM state if files has no explicit retention retention time set. Can be set to 'min', 'max', 'infinite' or a specific time in <number><suffix> format")]
[String]$DefaultRetentionPeriod,
[Parameter(Mandatory=$False, HelpMessage="The allowed minimum retention period for files to be committed to WORM state on the volume. Must be specified as <number><suffix>. Valid suffixes are 'seconds', 'minutes', 'hours', 'days', and 'years'")]
[String]$MinimumRetentionPeriod,
[Parameter(Mandatory=$False, HelpMessage="The allowed minimum retention period for files to be committed to WORM state on the volume. Must be specified as <number><suffix>. Valid suffixes are 'seconds', 'minutes', 'hours', 'days', and 'years'")]
[String]$MaximumRetentionPeriod,
[Parameter(Mandatory=$False, HelpMessage="The autocommit-period for the snaplock volume; any file unmodified for greater than this period will be committed to WORM state. Can be specified as <number><suffix>")]
[String]$AutocommitPeriod,
[Parameter(Mandatory=$False, HelpMessage="The autocommit-period for the snaplock volume; any file unmodified for greater than this period will be committed to WORM state. Can be specified as <number><suffix>")]
[Int]$ZapiRetryCount
)
#'------------------------------------------------------------------------------
#'Create the command for setting the volumes snaplock retention
#'------------------------------------------------------------------------------
[String]$command = "Set-NcSnaplockVolAttr -Volume $VolumeName "
If($MinimumRetentionPeriod){
[String]$command += "-MinimumRetentionPeriod $MinimumRetentionPeriod "
}
If($DefaultRetentionPeriod){
[String]$command += "-DefaultRetentionPeriod $DefaultRetentionPeriod "
}
If($MaximumRetentionPeriod){
[String]$command += "-MaximumRetentionPeriod $MaximumRetentionPeriod "
}
If($AutocommitPeriod){
[String]$command += "-AutocommitPeriod $AutocommitPeriod "
}
If($ZapiRetryCount){
[String]$command += "-ZapiRetryCount $ZapiRetryCount "
}
If($VserverName){
[String]$command += "-VserverContext $VserverName "
}
[String]$command += "-ErrorAction Stop"
#'------------------------------------------------------------------------------
#'Connect to the cluster
#'------------------------------------------------------------------------------
Connect-WFACluster $ClusterName
#'------------------------------------------------------------------------------
#'Invoke the command to set the snaplock retention for the volume.
#'------------------------------------------------------------------------------
Try{
Invoke-Expression -Command $command -ErrorAction Stop
Get-WFALogger -Info -Message "Executed Command`: $command"
Get-WFALogger -Info -Message "Set snaplock retention for volume ""$Volume"" on vserver ""$VserverName"""
}Catch{
Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
Throw "Failed Setting Snaplock retention for volume ""$VolumeName"" on vserver ""$VserverName"""
}
#'------------------------------------------------------------------------------
Note: I haven't tested this code. It's just an example to get you started.
/Matt
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.