How to disconnect unavailable network drives in Windows 10?
Solution 1
By default, drive mappings are completely separate for normal and elevated environments. You cannot use the "administrator" Command Prompt to manage non-admin network drives.
You can share network drive mappings between your own normal and elevated environments by changing the EnableLinkedConnections option. However, different user accounts will still always have separate drive mappings.
Solution 2
mountvol command can delete these stuck drive letters.
mountvol <Drive Letter>: /d
Example:
mountvol E: /d
Related videos on Youtube
Gábor Major
Updated on September 18, 2022Comments
-
Gábor Major over 1 year
My company laptop runs a command line script during boot which adds a set of network drives to the Windows. I'm not using any of these during work at all, I don't even have access to some of them (when I double click the drive I get an Access Denied error).
Lately I often have to connect to a VPN service for work with another company, and when I'm connected to their VPN, none of my company's network locations are available. Which produces a strange side effect: for some reason disk access becomes severely limited, e.g. when I click a download button in the browser, I have to wait 4-5 minutes for the download location popup to open, in the meanwhile the browser seems frozen. Similarly when saving files.
I can do the following: before I connect to the VPN, I can manually right click and disconnect each network drive. However I don't want to do this every single time, it's 6 drives, sometimes I forget and I have to disconnect the VPN, remove the drives and reconnect the VPN to solve the disk problem (disconnect doesn't work when on the VPN).
I tried to use the 'net use X: /delete' command from an administrator cmd to disconnect the drive (hoping to create a script to remove them), but for some reason it doesn't work. I get the below error:
C:\WINDOWS\system32>net use G: /delete The network connection could not be found. More help is available by typing NET HELPMSG 2250
Interestingly, 'net use' command output is empty:
C:\WINDOWS\system32>net use New connections will not be remembered. There are not entries in the list.
So, how come 'net use' says the list is empty, and it is not able to find the network connection, when I can see the mapped network drives with drive letters (G, H, etc) in the Windows file explorer, and I can right click and disconnect from them?
-
Akina over 4 yearsI'm not using any of these during work at all, I don't even have access to some of them Ask your admins to exclude your workstation/account from this policy.
-
Gábor Major over 4 yearsWell, this could be a viable approach also, but I fear I would be going down the rabbit hole through the endless company policies and protocols.
-
EmpathicSage almost 3 yearsSee also superuser.com/questions/996189/…
-
-
Gábor Major over 4 yearsThanks, this was reason. I was trying the command from administrator cmd, but I should have used my own user's cmd. Strange, I would expect a local admin user to be able to do this. Thanks again, I would upvote your answer but I can't yet :)
-
user1686 over 4 yearsDifferent users can have different network drives, that's completely normal...
-
Smock over 4 years@GáborMajor net use manipulates the current users mapped drives. When running cmd as admin, the current user in that session is the local admin. You can then map drives in that cmd prompt session separately to your own user session.
-
Meir Cohen over 3 yearsThank you. Your suggested approach helped me with 2 disconneced network drives which refused to disappear, even after
net use X: /delete
. -
dgo about 2 yearsBravo! This is super useful. Thanks!