Disconnect Mapped Network Shares via CMD

I have noticed that a network drive that I would manually map would still be accessible without re-logging in even after I had "disconnected" via right-clicking on the drive in My Computer. This kind of drove me nuts because it meant that there was some sort of persistent authenticated connection that was remaining when I did not want it to. I figured out a solution...

First off, you can connect to a share without mapping a drive letter from CMD by typing the \\[servername]\[share] into a windows explorer adddress bar. This will prompt you for the username and password. Once connected, you can drag the folder tiny folder icon on the left of the address bar to the desktop to create a shortcut link to the share.



For the more technical (and leading into the solution), this can also be done by opening a CMD windows and typing:

net use /user:[username] \\[servername]\[share] [password]

Now to ascertain the presence of all current share connections even if they are no longer visible in My Computer, open a command line window and type:

net use



This will display all active sessions on the PC with details such as status, remote address, Network type...

to clean house and disconnect all sessions type:

net use * /del

Retyping net use will indicate no entries.



To delete a specific session you will have to type:

net use \\[servername]\[share] /del


Hope this is of help to you. Peace.

No comments:

Post a Comment