Microsoft Virtualization Discussions

powershell - Set-NcSnapshotSnaplockExpTime

victor10
2,511 Views

I am trying to use  Set-NcSnapshotSnaplockExpTime to extend the  snaplock expiration  time of a snapshot  when I issue the command  In my poweshell script , it does not do anything , when I run it on the command line I get the following 

PS z:\> Set-NcSnapshotSnaplockExpTime  -volume victor_2019_test  -Snapshot daily.2020-06  -Expirytime 06/14/2020 -Vserver  soxdurhio01a01
Set-NcSnapshotSnaplockExpTime : No such file or directory
At line:2 char:1
+ Set-NcSnapshotSnaplockExpTime  -volume victor_2019_test  -Snapshot da ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (durarcclu01:NcController) [Set-NcSnapshotSnaplockExpTime], EAPIERROR
    + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapshot.SetNcSnapshotSnaplockExpTime
 

1 REPLY 1

mbeattie
2,432 Views

Hi Victor,

 

Is it possible there is a typo in the volume name based on the error 'no such file or directory'?

Do you still get the same error if you verify that the volume and snapshot exist?

 

$VolumeName   = "victor_2019_test"
$VserverName  = "soxdurhio01a01"
$Cluster      = "durarcclu01"
$SnapshotName = "daily.2020-06"
$Credential   = Get-NcCredential
If($Null -eq $Credential){
   Write-Warning -Message "You must provide credentials to connect to cluster ""$Cluster"""
   Break;
}
Import-Module DataONTP
Connect-NcController -Name $Cluster -HTTPS -Credential $Credential -ErrorAction Stop
$volume = Get-NcVol -Name $VolumeName -Vserver $VserverName -ErrorAction Stop
If($Null -eq $volume){
   Write-Warning -Message "The volume ""$VolumeName"" was not found on vserver ""$VserverName"""
   Break;
}
$snapshot = Get-NcSnapshot -Volume $VolumeName -SnapName $SnapshotName -Vserver $VserverName -ErrorAction Stop
If($Null -eq $snapshot){
   Write-Warning -Message "The snapshot ""$SnapshotName"" does not exist on volume ""$VolumeName"" on vserver ""$VserverName"""
   Break
}
Set-NcSnapshotSnaplockExpTime -volume $VolumeName -Snapshot $SnapshotName  -Expirytime $(Get-Date -Date '06/14/2020') -Vserver $VserverName -ErrorAction Stop  

 

 

/Matt

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