raandree / NTFSSecurity

Managing permissions with PowerShell is only a bit easier than in VBS or the command line as there are no cmdlets for most day-to-day tasks like getting a permission report or adding permission to an item. PowerShell only offers Get-Acl and Set-Acl but everything in between getting and setting the ACL is missing. This module closes the gap.
MIT License
426 stars 58 forks source link

Remove-Item2 unable to remove Junction #42

Open Skons opened 5 years ago

Skons commented 5 years ago

When you try to remove a junction, the following error is returned

remove-item2 : (87) The parameter is incorrect: [\\?\D:\testjunction]
At line:1 char:1
+ remove-item2 -Path .\testjunction\
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (.\testjunction\:String) [Remove-Item2], IOException
    + FullyQualifiedErrorId : DeleteError,NTFSSecurity.RemoveItem2

image

raandree commented 5 years ago

Thanks for reporting this. However I am unable to repro it. What OS / PowerShell version do you use?

PS D:\Test> New-Item -Name Juntion1 -Value .\Folder1\ -ItemType Junction

    Directory: D:\Test

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d----l         4/3/2019   1:18 PM                Juntion1

PS D:\Test> dir

    Directory: D:\Test

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         4/3/2019   1:18 PM                Folder1
d----l         4/3/2019   1:18 PM                Juntion1

PS D:\Test> Remove-Item2 -Path .\Juntion1\
PS D:\Test> dir

    Directory: D:\Test

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         4/3/2019   1:18 PM                Folder1