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
Powershell commandlet Remove-NcFile doesn't work in symlink type
2017-09-27
03:54 AM
5,282 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
Thanks
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
Andrew
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried also this syntax :
Remove-NcFile /vol/u1/shared/_Exchange_Insite -VserverContext SVM_BP2I
The issue still there.
Bachir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Andrew
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 10.65.180.184
Delete :
Remove-NcCifsSymlink -VserverContext SVM_BP2I -UnixPath /home/SVM_BP2I/data1/_Exchange_Insite/
Remove-NcFile /vol/u1/shared/_Exchange_Insite -VserverContext SVM_BP2I
Bachir