NTFSSecurity
NTFSSecurity copied to clipboard
Remove-Item2 unable to remove Junction
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

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