Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to use Powershell to set the snapshot -snaplock-expiry-time ? Thanks!
2023-12-27
07:48 PM
1,946 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
cluster1> volume snapshot create -vserver vs1 -volume vol1 -snapshot snap1 -snaplock-expiry-time "11/10/2022 09:00:00"
Example CLI as above I want to do it in Powershell way, thanks!
Solved! See The Solution
1 ACCEPTED SOLUTION
ACWCalvinWong has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey there, there is no native function in the Powershell Module atm. You have todo it via API. This is how I do it:
$VOLUMEURL = "https://NETAPPURL/api/storage/volumes/VOLUMEUUID/snapshots/SNAPSHOTUUID"
$RESPONSE = Invoke-RestMethod -Uri $VOLUMEURL -Method GET -Credential (Get-Credential) -SkipHeaderValidation -ErrorAction Stop -SkipCertificateCheck
$PAYLOAD = @{
"snaplock_expiry_time" = "2069-06-04T19:00:00+00:00" #Edit this to the desired expiration
} | ConvertTo-Json
$RESPONSE = Invoke-RestMethod -Uri $VOLUMEURL -Method Patch -Body $PAYLOAD -Credential (Get-Credential) -SkipHeaderValidation -ErrorAction Stop -SkipCertificateCheck
$RESPONSE = Invoke-RestMethod -Uri $VOLUMEURL -Method GET -Credential (Get-Credential) -SkipHeaderValidation -ErrorAction Stop -SkipCertificateCheck
Please refer to the post I did prior to this:
Best regards
Kai
1 REPLY 1
ACWCalvinWong has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey there, there is no native function in the Powershell Module atm. You have todo it via API. This is how I do it:
$VOLUMEURL = "https://NETAPPURL/api/storage/volumes/VOLUMEUUID/snapshots/SNAPSHOTUUID"
$RESPONSE = Invoke-RestMethod -Uri $VOLUMEURL -Method GET -Credential (Get-Credential) -SkipHeaderValidation -ErrorAction Stop -SkipCertificateCheck
$PAYLOAD = @{
"snaplock_expiry_time" = "2069-06-04T19:00:00+00:00" #Edit this to the desired expiration
} | ConvertTo-Json
$RESPONSE = Invoke-RestMethod -Uri $VOLUMEURL -Method Patch -Body $PAYLOAD -Credential (Get-Credential) -SkipHeaderValidation -ErrorAction Stop -SkipCertificateCheck
$RESPONSE = Invoke-RestMethod -Uri $VOLUMEURL -Method GET -Credential (Get-Credential) -SkipHeaderValidation -ErrorAction Stop -SkipCertificateCheck
Please refer to the post I did prior to this:
Best regards
Kai
