Effective December 3, NetApp adopts Microsoft’s Business-to-Customer (B2C) identity management to simplify and provide secure access to NetApp resources.
For accounts that did not pre-register (prior to Dec 3), access to your NetApp data may take up to 1 hour as your legacy NSS ID is synchronized to the new B2C identity.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Microsoft Virtualization Discussions

Powershell commandlet Remove-NcFile doesn't work in symlink type


THe command Remove-NcFile fails when I try to remove the below link



C:\Windows\System32> Read-NcDirectory u1/shared  | ? {$_.Type -eq "symlink"} | Remove-NcFile -Confirm:$false
Remove-NcFile : No such file or directory
At line:1 char:59
+ ... 1/shared  | ? {$_.Type -eq "symlink"} | Remove-NcFile -Confirm:$false
+                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (xxx.xxx.xxx.xxx:NcController) [Remove-NcFile], EONTAPI_ENOENT
    + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.File.RemoveNcFile


The symlink exist :


PS C:\Windows\System32> Read-NcDirectory u1/shared  | ? {$_.Type -eq "symlink"}

Name                                     Type            Size      Created     Modified Owner Group   Perm Empty
----                                     ----            ----      -------     -------- ----- -----   ---- -----
_Exchange_Insite                         symlink        38 B     27-Sep-17    27-Sep-17     0     0    755


Any idea ?





What is the path to the file/symlink that is being passed to the Remove-NcFile cmdlet?  Note that it should be "/vol/<volumename>/path/to/symlink".



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


I tried also this syntax :


Remove-NcFile /vol/u1/shared/_Exchange_Insite -VserverContext SVM_BP2I


The issue still there.




Just to confirm, I tested on my ONTAP 9.1P2 system and didn't experience any issues.


Read-NcDirectory -VserverContext $svmName -Path "/vol/$($volName)" | ?{ $_.Type -eq "symlink" } | %{ Remove-NcFile -VserverContext $svmName -Path "/vol/$($volName)/$($_.Name)" -Confirm:$false }


What version of ONTAP are you using? What user are you connecting to the cluster as?  What is the permission style on the volume?



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


Thanks for your replay !


Versions tested : 8.3.2, 9.1 and 9.2


Storage :


vol create -vserver SVM_BP2I  -volume data1 -aggregate cOT_demofr_01_SATA -size 1g -security-style ntfs -junction /vol/data1
vol create -vserver SVM_BP2I  -volume u1 -aggregate cOT_demofr_01_SATA -size 1g -security-style ntfs -junction /vol/u1
qtree create -vserver SVM_BP2I  -volume data1  -qtree _Exchange_Insite -security-style ntfs
qtree create -vserver SVM_BP2I  -volume u1  -qtree shared -security-style ntfs
cifs share create -vserver SVM_BP2I  -share-name data1 -path /vol/data1
cifs share create -vserver SVM_BP2I  -share-name shared -path /vol/u1/shared

cifs share modify -vserver SVM_BP2I -share-name shared -path /vol/u1/shared -symlink-properties read_only,enable
cifs share modify -vserver SVM_BP2I -share-name data1 -path /vol/data1 -symlink-properties read_only,enable


Here a part of the script to create and delete symlink


Create :

new-ncsymlink -target /home/SVM_BP2I/data1/_Exchange_Insite/ -LinkName /vol/u1/shared/_Exchange_Insite

add-nccifssymlink -unixpath /home/SVM_BP2I/data1/_Exchange_Insite/ -cifspath /_Exchange_Insite/ -locality widelink -sharename DATA1 -CifsServer


Delete :

Remove-NcCifsSymlink -VserverContext SVM_BP2I -UnixPath /home/SVM_BP2I/data1/_Exchange_Insite/

Remove-NcFile /vol/u1/shared/_Exchange_Insite -VserverContext SVM_BP2I



NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner