PowerShell Remove Junction

have a try on this "command-let":

cmd /c rmdir .\Target

source:Powershell Remove-Item and symbolic links


Is there a way to remove a junction using PowerShell?

Currently, at least in PowerShell v5, this is considered "fixed". What you can do is use the -Force switch, else you will get an error calling the path an NTFS junction. The reason that I at least use the quotes on fixed is that using the switch will still make the message about children in the directory show up. Selecting Y will still only delete the junction in my testing using PSv5.

Remove-Item "C:\temp\junction" -Force -Confirm:$False

If that doesn't work for you or you don't have v5 you can use the .Net method to delete a directory. This appears to work correctly as well.

[io.directory]::Delete("C:\temp\junction")