DatacenterDudes / cDOT-CIFS-share-backup-restore

These PowerShell scripts allow storage administrators to back up and restore CIFS share configurations for storage virtual machines in NetApp's clustered Data ONTAP. These require the NetApp PowerShell Toolkit module to be installed. These scripts are not officially supported by NetApp (but the PowerShell modules are) and should be used only with thorough testing.
21 stars 9 forks source link

Restore of combined nfs/cifs export-policy rules doesn't work #9

Open mb-1408-de opened 4 years ago

mb-1408-de commented 4 years ago

Restoring export-policy rules with more than one protocol fails because of the double-quotes in the cmd string. It seams to be the same issue as in the symlink settings of an cifs share. This code fixed it for me:

$myProtocol = $_.Protocol

    if (($myProtocol -ne $null) -and ($myruleProtocol -ne ""))
    {
        $myProto = ""
        foreach ($prop in $myProtocol) {
            if ($myProto -eq "")
            {
                $myProto = $prop
            } 
            else
            {
                $myProto = $myProto , $prop -join ','
            }
        }
        $mycmd = $mycmd + " -Protocol $myProto"          
    }