10

How do I really disconnect from a network share in Windows 8.1?

I'm familiar with using net use to disconnect from a network share, even if it isn't mapped to a network drive letter:

net use \\server\share /del

However, even after doing so, the folder may remain connected: if I quickly open Windows Explorer and go to \server\share, it connects immediately, without prompting me for a password, and I can do whatever file operations I want in that folder without it ever showing up again in net use's output.

If I use net use /del then leave things alone for 10-15 seconds, then the share appears to really disconnect, so that Windows Explorer prompts for password and takes time to reconnect and so on.

I'm not sure that this is a duplicate of this question; that makes it sound like net use sometimes fails, while my issue is that it appears to work but leaves connections open that it can't see.

Is there a way to really, truly close network share connections, besides net use? Is there a way to see what connections are open that net use isn't telling me about?

(This is using a Windows 8.1 Active Directory domain member as a client and a non-domain member Samba server.)

Josh Kelley
  • 1,527
  • 2
  • 15
  • 29
  • 2
    Well, with Windows 7: Remove the connections with `net use * /del` then restart the *Workstation* service (may have to close open Explorer windows and files on the share first). This will terminate everything. Also take a look at the *Credential Manager* in case you want to remove any stored credentials. Not sure how much of this applies to Windows 8. – Jason C Feb 28 '15 at 02:01

3 Answers3

8

Run net use * /delete instead. This will remove all share connections, and force you to use a new username/password, unless you're on a domain joined computer

Canadian Luke
  • 24,199
  • 39
  • 117
  • 171
  • 1
    Also use `klist purge` from the other answer. I wasn't able to reconnect with a different user until I used this. Make sure to execute this as your user and *not* as Administrator. – user643011 Sep 26 '20 at 11:39
  • This part of windows is horribly inconsistent, I'm connected to a network share and running this just shows `There are no entries in the list` – Douglas Gaskell Dec 12 '21 at 19:41
6

It sounds like what you're running into is Kerberos credential caching, which refreshes on a timed interval.

Try this, which will disconnect the map, and then purge the Kerberos list:

net use \\server\share /del
klist purge

klist by itself should show you currently active Kerberos 'tickets', that may be used.

Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
  • Interesting. I did not know about `klist`, but doing `klist purge` didn't help. (My server is not a domain member, so Kerberos isn't involved, is it?" – Josh Kelley Sep 02 '14 at 19:45
  • Hmm... If you kill the map, and then immediately kill and restart Explorer.exe, does it clear the cached credentials? – Ƭᴇcʜιᴇ007 Sep 02 '14 at 19:50
1

8 years later still same issues...

"Klist purge" and restarting the explorer service did not work in a few cases I've tried. A reboot has worked for me on many occasions but restarting the workstation service also did the trick

Tip to Restart the workstation service:

You may use hotkey Win+R and run services.msc look for "Workstation Service" and restart it (or stop and start it again)

PPL
  • 11
  • 2
  • Omg what a glitch. To automate in elevated PowerShell: Stop-Service LanmanWorkstation -Force; Start-Service LanmanWorkstation – Daniel Dec 12 '22 at 16:41