I have a file server running (SMB) that I connected to in Explorer (Windows 7 Professional) by visiting \\18.104.22.168 directly. I logged in as one user, without saving credentials, and now wish to log out (actually I want to change to a different user, but being able to log out in general would be useful).
I have searched around for ways to do this and found a bunch of info that suggests using some form of
net use \\22.214.171.124 /del:
- How to logout from a Windows shared folder?
- How do I change the user I am logged in with on a Network Share?
- Using Different Credentials to Access Shared Folders in Windows 7 (www.raymond.cc)
- How do I remove login credentials for a network location in Win7? (serverfault.com)
- Logging out of a network share drive without reboot?
However, none of these actually seemed to work for me. I run
net use * /del, then use
net use to verify that the list is empty, and yet the share mysteriously remains in explorer, unaffected, accessible, and still using the previous login.
Another thing I tried, which also failed, was doing e.g.
net use \\126.96.36.199 /user:newusername to switch the credentials. However, even when
net use showed an empty connection list, this still produced an error stating that multiple connections to the same resource with different users were not allowed – why there were connections that didn't show up in
net use's list is a mystery to me.
I then found this article How to logout from shared folder (microsoft.com), which recommends:
net use * /del(or whatever server).
- Clear credentials from Credential Manager.
- Restart the Workstation service.
This procedure worked for me. There was nothing of interest in the Credential Manager, as I did not save credentials, however restarting the Workstation service after clearing the connections with
net was the key (I did have to close all explorer windows to get the service to restart).
My question is: This is not very convenient at all, especially when I have to explain it to less tech-savvy users. While I could certainly create e.g. a batch script to automate the whole thing, is there an actual, proper, consistent way to do this that doesn't involve restarting services (and possibly doesn't involve the command line, although personally I don't mind)?
Also, a sub-question: It is weird to me that the vast majority of resources I found on this matter didn't suggest restarting Workstation, and the suggested process of using
net use alone seemed to work at least for the other people who posted comments on those posts. Is the Workstation restart unique to me and indicative of some other issue on my machine, or was it just left out of all the instructions for some reason? Only the microsoft.com support post had instructions that recommended this step, which is what finally got it working for me.
Logging out of a share seems like it would be a common enough use case to justify some simple way to do it, so I am baffled by how difficult it was for me to figure this out.
Other things I've tried with no effect:
- Closing all Explorer windows before and after using
net usecommands (as suggested in Kody Browns's answer), as well as futzing with the "separate process per folder window" settings hoping it was some sort of per-process credential caching (also inspired by that answer).
- Changing homegroup connection management settings (suggested by holmzi_online's answer at the above microsoft.com post).
- Killing all explorer processes (including the main one) and restarting explorer after
net use * /del(suggested by Robert Greer here, although that issue was with mapped drives).