28
4
The drive is disconnected, and I'm off the network. How do I unmap the drive?
28
4
The drive is disconnected, and I'm off the network. How do I unmap the drive?
20
I can't test this here as I'm not on a network, but I think it's a case of doing this:
I think it's something like that but as I say, I can't test it here.
26
On the command line (substitute your drive letter for z
):
net use z: /delete
13
On the command line, try:
net use
This shows all currently mapped drives. If the one you're looking for is in the list, you can use:
net use x: /delete
where X: is the drive you're trying to remove. But if the drive has been removed, there may be no such drive letter shown. In that case, just type the Remote identifier for the mapping:
net use 192.168.10.11\WorkFiles /delete
1This worked perfect for me and covers all possibilities. This should be the correct answer! – Cagy79 – 2016-08-12T09:55:10.757
2
There is a more forceful way to get rid of dead links to mapped network drives.
You could delete the reference in your registry.
Just open "regedit.exe" and expand the key "HKEY_CURRENT_USER" and the key "Network". There you will see keys with letters that will represent the Mapped Drive Letters. When you delete a letter on "regedit.exe", the mapped drive letter will vanish on the next Windows restart cycle.
1
For the disconnected drive, for those who have SQL Server Management Studio in your pc, just run this query.
Exec master.dbo.xp_cmdshell 'net use x: /delete'
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
Enable the xp_cmdshell
by running this query:
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
-1
None of the above worked for me in Windows 10 for disconnected USB drives. What did work was:
1The question is about network drives rather than USB drives. Will this work for network drives when you are not connected to the network? – fixer1234 – 2017-03-11T19:57:19.433
1Please read the question again carefully. Your answer does not answer the original question. – DavidPostill – 2017-03-12T11:35:37.227
-1
On Windows 7 you have to change the the automatically-connect-on-startup option to do not reconnect. I did this by remapping the drive identical to how it was, which then gave me the the checkbox for do not reconnect on startup. Restarted the machine and it was gone!
4You don't even need to type in delete, you can get away with just del. Look at how much quicker you can disconnect! – Mitch – 2011-12-01T19:30:53.667
3This does not work with disconnected drives! – Tom – 2013-06-17T15:28:29.137
4This is much better than using the Windows Explorer approach if the drive isn't currently accessible. Even in Windows 8 you have to wait quite some time for the right-click context menu to appear for an unavailable mapping. With the command line approach it's immediate. – Bern – 2013-06-28T08:26:18.357