NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

ONTAP Discussions

PowerShell - Set Snaplock type as Compliance

goodmanr0732
4,461 Views

Does anyone know of a cmdlet or way that I can set the Snaplock type as compliance using Powershell? Can't seem to find a cmdlet that will let me do this.

1 ACCEPTED SOLUTION

mbeattie
4,373 Views

Hi,

 

I checked a development release of the PSTK and SnapLock properties are being included in a future release within the New-NcVol CmdLet that leverages the REST API's. There is work being done to address the functionality gap but I'm not sure when it will be released

    -Snaplock [<DataONTAP.C.Types.Volume.Snaplock>]
        Specifies the snaplock attribute to use for this volume. To instantiate the please create object using New-Object DataONTAP.C.Types.Volume.Snaplock. This parameter is supported with Rest only.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

5 REPLIES 5

mbeattie
4,407 Views

Hi,

 

You could use Invoke-NcSystemApi...something like this:

$command = @("snapshot", "modify-snaplock-expiry-time", "-vserver", $vserverName, "-volume", $VolumeName, "-snapshot", $snapshotName, "-expiry-time", """$expiryTime""")
$api = $("<system-cli><args><arg>" + ($command -join "</arg><arg>") + "</arg></args></system-cli>")
Invoke-NcSystemApi -Command $command -ErrorAction Stop

 Hope that helps

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

goodmanr0732
4,397 Views

This is for when creating the volume. When creating a volume in the ontap CLI there is a -snaplock-type option when doing a volume create command that you can set as either non-snaplock, compliance, or enterprise. The New-NcVol cmdlet doesn't seem to have a parameter for that and can't find any other cmdlet that has that either.

mbeattie
4,384 Views

Which version of ONTAP are you using? There is a snaplock type in the REST API (not certain which version it's introduced in but it's available in ONTAP 9.10). If your ONTAP version supports the snaplock feature when creating a volume you could use the REST API instead of a PSTK CmdLet. If that's not an option for you then in the interim you could use the CLI command to create a volume and pass the command via "Invoke-NcSystemApi" as per the example above (not ideal but it would work). Also there is work being done on a PSTK version that leverages the REST API's so i would imagine this will be available in a future release. I'll check.

 

volume_snaplock.png

 

Hope that helps

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

mbeattie
4,374 Views

Hi,

 

I checked a development release of the PSTK and SnapLock properties are being included in a future release within the New-NcVol CmdLet that leverages the REST API's. There is work being done to address the functionality gap but I'm not sure when it will be released

    -Snaplock [<DataONTAP.C.Types.Volume.Snaplock>]
        Specifies the snaplock attribute to use for this volume. To instantiate the please create object using New-Object DataONTAP.C.Types.Volume.Snaplock. This parameter is supported with Rest only.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

goodmanr0732
4,357 Views

Thank you for looking into that, glad to see that it will be coming. Think for now I'll just look at trying a REST API call to do it.

Public