Problem:
I have a mapped network drive that I am trying to disconnect and when I try to disconnect, I get a message Access Denied. I am an admin on the computer and have all the permissions to delete, but I am being denied access. Is there a way to delete it in the registry or via a PowerShell command?
Resolution:
Open Command Prompt as an administrator.Then, use the net use
command to disconnect the mapped network drive.
net use X: /delete
Replace “X:” with the drive letter assigned to the mapped network drive.
Sometimes, Windows may not immediately remove the mapped drive from File Explorer even after using the net use
command. To manually remove it:
a. Open File Explorer. b. Click “This PC” or “Computer” in the navigation pane. c. In the “Network locations” section, you should see the mapped network drive. Right-click it and select “Disconnect.”
You can also use PowerShell to remove a mapped network drive. Open PowerShell as an administrator and use the Remove-SmbMapping
cmdlet.
Remove-SmbMapping -LocalPath X:
Replace “X:” with the drive letter assigned to the mapped network drive.