I have a file server running (SMB) that I connected to in Explorer (Windows 7 Professional) by visiting \\ 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 \\ /del:

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 \\ /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:

  1. net use * /del (or whatever server).
  2. Clear credentials from Credential Manager.
  3. 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 use commands (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).
  • 1
    @sttr Thanks, but I'm not sure I see the connection between this and that article. Can you give a hint? – Jason C Feb 28 '15 at 15:09
  • Hint that mode ABE each user sees only the folders and files which he is entitled. Otherwise, the user must be self-sufficient in order to access the resources and without the need to enter a password. If the "server" is Windows 7, then look slickit.ca/2009/07/webdav-on-windows-7.html – STTR Feb 28 '15 at 16:37
  • 1
    @STTR Thanks. How does hiding folders from unauthorized users or setting up a WebDAV server help log out of a SMB share accessed by typing \\address? – Jason C Feb 28 '15 at 16:41
  • 1
    @STTR The question is, as the title implies, how to log out from a shared folder (SMB, which is what Windows uses for "shared folders") without restarting the Workstation service (see also, "I logged in as one user, without saving credentials, and now wish to log out"). I'm not adding WebDAV to my servers, nor can I add WebDAV services to servers I have no control over, nor am I clear on how that solves the problem of logging out conveniently. Do you know how to log out of a shared folder? – Jason C Feb 28 '15 at 17:00

I got it working by doing the following:

  1. Run net use * /delete
  2. Clear the credentials (e.g. mine is, and the date of create is today, just it)
  3. Disable "local connect" (Control Panel\Networking and Internet\Net Connect\Local Connect)
  4. Wait a moment (I don't why but I think it may break some links from my Win7 to Ubuntu and may clear some cache)
  5. Enable "local connect" and it worked..
| improve this answer | |
  • 3
    What do you mean by "Clear the credentials" and how do you do that? – Calimo Jul 12 '17 at 7:29
  • 1
    "Clear the credentials" is entirely unclear here. – Jonathan Wood May 9 '18 at 17:26
  • I think its a reference to the prompt you get after entering the net use * /delete command: Continuing will cancel the connections. Do you want to continue this operation? (Y/N). – Jet Blue May 20 at 4:33

2) You are not alone in this issue. Most people probably never experience it because they only have one user and/or multiple users but all with the same password. I seem to experience it all the time. I'm assuming it is because I have the same user name on multiple computers but with different passwords.. (I am not in a domain; laptop is Windows 8.1 with Windows and Linux-based servers..)

(from memory) If I open the root share of a computer, such as \raspi, before accessing a locked down share such as \raspi\private I will have that issue. It seems that a connection is made using the public/open share first and then it gets stored.

As for 1), I only need to close the Explorer windows and (sometimes command prompts) that have accessed that share. I have never had to restart the workstation service.

But it may work for me because I always tell Windows to "launch folder windows in a separate process"..

Just a thought..

| improve this answer | |
  • Thanks!! I was really hoping your suggestion of closing the explorer windows would be the simple fix (I also have separate processes per folder windows), maybe some per-process cached credentials. Unfortunately, that didn't do the trick, nor did disabling separate processes per window. I also didn't see any change in behavior if I tried to access \\\Share first instead of the root (also no difference in accessing by host name rather than IP). I'm also not in a domain, and using Windows and Linux based servers. Something is saving credentials or connections, but I don't know what. – Jason C Feb 28 '15 at 23:54
  • Another data point: Regardless of the process-per-folder settings, killing all explorer processes (including the main one) and restarting explorer also had no effect, which surprised me. – Jason C Mar 1 '15 at 0:04
  • I am about to play around with my environment a little bit to test this out more, and had a thought.. your windows (explorer, command prompt, etc.) are all Elevated or all not, right? I've been frustrated many times when I didn't realize or forgot one of my apps was elevated.. It does some weird things to network shares... – kodybrown Mar 1 '15 at 17:10
  • The account I have been using is an administrator and everything is elevated. I created a new non-administrator account and tested from there, the behavior is unchanged. – Jason C Mar 2 '15 at 0:47

This might be a long shot, but did you wait long enough after using net use * /d? As far as I know, even after deleting the share, Windows keeps the session open if there are open handles (Explorer window, etc.). And even after closing those handles, there is a time-out period during which it will reconnect the share. The default seems to be 10-15 minutes. You can shorten this in the registry.

See https://blogs.msdn.microsoft.com/oldnewthing/20110223-00/?p=11413

However, it seems that "KeepConn" is no longer used in newer versions of Windows. See "Idle Connection Timer" on this page: http://blogs.msdn.com/b/openspecification/archive/2013/03/19/cifs-and-smb-timeouts-in-windows.aspx

| improve this answer | |

Start -> Control Panel -> User Accounts and Family Safety -> User Accounts -> Manage your credentials.

Expand one of your "Windows Credentials", and then click on "Remove from vault".

Start -> Control Panel

Control Panel -> User Accounts and Family Safety

User Accounts and Family Safety -> User Accounts

User Accounts -> Manage your credentials

Log out


| improve this answer | |
net use * /del
net stop Workstation /Y
cmdkey /delete:<resourcename>
net start Workstation
net start browser

Way 2: use Multiple NetBIOS names for one computer:

reg add "HKLM\System\CurrentControlSet\Services\LanmanServer\Parameters" /v OptionalNames /t REG_MULTI_SZ /d "NetBIOSName01\0 NetBIOSName02\0 NetBIOSName03\0"

Then you can connect the resources of different users using different NetBIOS names.

net use L: \\NetBIOSName01 /user:<username01> <password01> /P:Yes
net use M: \\NetBIOSName02 /user:<username02> <password02> /P:Yes
net use N: \\NetBIOSName03 /user:<username03> <password03> /P:Yes

Edit %windir%\system32\drivers\etc\lmhosts and add

<Server IP>  NetBIOSName01            #PRE
<Server IP>  NetBIOSName02            #PRE
<Server IP>  NetBIOSName03            #PRE
<Server IP>  <OriginalNetBIOSname>            #PRE

in all network workstation

All users will connect to its resources.

| improve this answer | |
  • As per question title, this doesn’t answer the question. – Daniel B Feb 28 '15 at 17:13
  • Thanks, but this restarts the Workstation service. I mentioned this in the question, but I already know I can automate the restart with a script. Actually, I posted roughly the same command set at superuser.com/a/883606/245945. What I'm actually looking for is detailed where I wrote "question" and "sub-question" in bold in my post. – Jason C Feb 28 '15 at 17:17
  • @JasonC The original cause of all these actions System error 1219? – STTR Feb 28 '15 at 18:04
  • @STTR The original cause is a desire to log out without restarting services. The results of my attempts are described in my post. – Jason C Feb 28 '15 at 23:23
  • @STTR Thanks. The update is interesting and I appreciate your time, but I am unclear about the connection. I'm not trying to map drives or log in with multiple users at the same time. I'm simply trying to log out of a share originally accessed by going directly to \\address. It doesn't necessarily even need to be to switch users. Perhaps I'm just stepping away from the computer and I don't want to leave the share logged in. How will logging in as multiple users over multiple shared drives help to log out of a shared folder without restarting services? – Jason C Mar 1 '15 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.