#Powershell Isssue

1 messages · Page 1 of 1 (latest)

soft horizon
#

Hello,
I have a problem with the new versions of the NetApp PowerShell resource kit.

ONTAP : 9.11 and more
Toolkit 9.10 and more,

I had a procedure that allowed me to change the snapshot retention policy of an SVM:
ForEach ($GetSVMPolicy in Get-NcVserver -name $SVM | Get-NcSnapshotPolicy -Name p.* | Select-Object Policy)
{
Get-NcVserver -name $SVM | Set-NcSnapshotPolicySchedule -Name $GetSVMPolicy.Policy -Schedule daily -Count 20
}
The first line retrieves the SVM policy snapshots and the other modifies them.
Have you ever had this problem? do you have an idea ?
THANKS

void carbon
#

Hi Cyrille,
Maybe it can be a ZAPICall issue. At least the behavior are not the same using default REST API or legacy ZAPI

soft horizon
#

Hi Pierrick,
yes 😉
I add "zapicall" for connection and it's better : Connect-NcController ${Cluster} -ZapiCall

winged lodge
#

I don’t see a problem in the opening statement. Are you receiving an error? Also, please wrap your code in triple-ticks for readability.

void carbon
#

The issue is about Cmdlet behavior that is modified since ZAPI Call are replaced by REST API
Old scripts need to be checked each time Powershell Toolkit is updated because the result from cmdlet is not the same.
In this example the missing point from REST API calls is the Vserver/SVM context

soft horizon
#

Hello James, I receive this error message

Set-NcSnapshotPolicySchedule : Scope parameter neither specified nor set

I solved my issue with those syntax

Connect-NcController ${Cluster} -ZapiCall
ForEach ($GetSVMPolicy in Get-NcVserver -name $SVM | Get-NcSnapshotPolicy -Name p.* | Select-Object Policy)
    {
        Get-NcVserver -name $SVM | Set-NcSnapshotPolicySchedule -Name $GetSVMPolicy.Policy -Schedule daily -Count 70 | Out-String
    }

or

Connect-NcController ${Cluster} -Vserver $SVM
ForEach ($GetSVMPolicy in Get-NcSnapshotPolicy -Name p.* | Select-Object Policy)
    {
        Set-NcSnapshotPolicySchedule -Scope svm -VserverContext $SVM -Name $GetSVMPolicy.Policy -Schedule daily -Count 70 | Out-String
    }

I have another issue with those commande Without "ONTAPI"

this command are executed without error, but don't working

Invoke-NcSnapMirrorBreak -Destination $DRSrcSVM -Confirm:$false -ErrorAction stop -ONTAPI

And this commande are executed without error, "PreserveIdentity" are not enabled

New-NcSnapMirror -Source $SRCSVM -Destination $DSTSVM -PreserveIdentity -policy MirrorAllSnapshotsDiscardNetwork -type vault -schedule hourly -ErrorAction stop -ONTAPI