How to delete cached temporarily credentials for a network share on a Windows machine without rebooting or logging off

493,085

Solution 1

NOT FOR WINDOWS 10 (I am answer for WINDOWS 7)

To delete all network authentication

C:\> net use * /d

To view current network connection

C:\> net use 

IMPORTANT NOTE

I tested in Windows 7 SP1 64 Bits, 100% WORK

After run the command, you need to go to task manager delete the explorer.exe , then reopen the application again.

To open the application, go to RUN, enter explorer.exe

Now you are fully clear the connection information in the session.

Solution 2

I know this is old, but in case anyone reads this in the future....

The next time this occurs I have found the best way to get rid of the credentials is to open an elevated command prompt and type in:

net use \\server\share /delete

then type in:

klist purge

I tried it with both command individually and they do not work alone. You have to first remove the connection if it exists. Then remove the Kerberos authentication ticket from the machine. I had an incident like yours where the connection no longer existed but the Kerberos ticket had not expired yet, so when I went back in and had not logged off of the machine it would use my previously entered credentials. By purging the ticket it prompted for credentials again.

Solution 3

Go to the control panel -> User accounts -> click on your name -> to the left click on "credentials" (or manage your credentials). All the used network credentials will be there.

Solution 4

The following should do what you want.

C:\> net use \\server\share /d
C:\> net use \\server\ipc$ /d

Solution 5

I have managed to access the share using the domain name instead of the IP, but I am curios.

This is a sign of bad client side cache and usually relates with netbios.

Try to restart the below list of services and if need, kill explorer, start the task manager and start it again via the task manager file->run entry, as explorer may also be caching things from those services.

I don't know exactly what is the failing service on your side, so you can try this this list, one at time to see if it works:

-TCP/IP NetBIOS Helper (can even be off if you add your machines to the DNS/host file)
-Workstation    <---   TRY THIS ONE FIRST
-computer browse
-net logon
-rpc service

if it works, report back what was the service, so others can try it directly

good luck

Share:
493,085

Related videos on Youtube

ralz
Author by

ralz

Updated on September 18, 2022

Comments

  • ralz
    ralz almost 2 years

    This is more of a curiosity then a real problem, I am just to lazy to reboot or log off my laptop.

    I have connected to a network share on a Windows server with domain credentials from a non-domain Windows 7 machine, I didn't mark the option to remember the password.

    The share is let's say \\10.10.10.10\folder.

    I have changed the password for that domain account in the meantime, and now when I try to access that share I get the following error:

    Logon failure: unknown user name or bad password

    I have tried the following on the client side:

    • deleting cached credentials in Credential Manager
    • running net use delete
    • running net session \\ip.of.the.server /delete gives me "A session does not exist with that computer name."
    • running net use \\10.10.10.10\folder /u:DOMAIN\USER password gives me "The command completed successfully.", but I still get the same unknown user name or bad password when trying to access the share from Windows Explorer
    • mapping the share as a network drive from GUI, but then I get

      The network folder specified is currently mapped using a different user name and password.
      To connect using a different user name and password, first disconnect any existing mappings to this network share.

    • running net use to see connections, I get that there are no connections in the list
    • killing explorer.exe and starting it again.

    I have tried the following on the server side:

    • going to Computer Management > Shared folders > Sessions to kill the session with my username
    • rebooting the server

    I have managed to access the share using the domain name instead of the IP address, but I am curios.

    Does anybody know any way how to delete the cached credentials in this case? Where are credentials cached when you don't mark the remember password option when accessing the share, they are not shown in Credential Manager and there is no mapping shown when you run net use.

    • kralyk
      kralyk over 11 years
      You'd need to kill the session at the server side through computer management on the server itself unless I'm missing something in your question.
    • ralz
      ralz over 11 years
      The question is how to do this on a client side on the Win7 machine, when you don't have privileges on server to kill a session. I'm curios where are the credentials cached on a client side in this case
    • kralyk
      kralyk over 11 years
      You've done what can be done from the client side. The only thing remaining is the cached session on the server side. If you don't have privileges on the server, then the question belongs on superuser.com and not SF. Short of rebooting, which you already specified.
    • ralz
      ralz over 11 years
      I played a little with server side over the night, server side doesn't play any role in this caching, i tried going to sessions in computer management and even rebooting the server, like i side not really a problem more a curiosity, it seem that in cases like this you either have to switch from ip to domain name or vice versa, or rebooting or logging of the computer
    • kralyk
      kralyk over 11 years
      If you've done "net use" by itself and nothing is in the list and you've done everything else mentioned I don't know why it would still persist...sorry.
    • Admin
      Admin almost 11 years
      This information is useful when I was having problem regarding changing of User Credentials. I find this tutorial is useful for such kind of Problems.
    • XP1
      XP1 about 7 years
      @rocketsarefast and I have discovered another way to clear the network credentials. I have posted my answer in this thread: How do I remove login credentials for a network location in Win7?: https://serverfault.com/questions/213765/how-do-i-remove-log‌​in-credentials-for-a‌​-network-location-in‌​-win7/853860#853860
    • Ryan
      Ryan over 4 years
      For what it's worth there is not a single answer on this page (including comments) that works for me. I can not get the darn explorer to prompt me for credentials. Why wouldn't Microsoft put something in the context menu to "open as" or something so you can change the user? This is something that drives me insane at work a lot. In my office with our user setup (military so I can't change it) this is something I have to do constantly.
  • ralz
    ralz over 11 years
    I have said in the question that I tried using the Credential Manager, I didn't use the remeber password option, and it seems that in this case the credentials are not there
  • ralz
    ralz over 11 years
    yes i tried net use \\share /u:domain\user and it would always gave me an error, the windows obviously sees the share as mapped but it is not showing it when i run net use, i get that there are no connections in list (see also the error i gui in the question)
  • Goez
    Goez over 11 years
    but have you specified the password also on the command line? like net use \\share /u:domain\user password? This can also be done. another option is net session \\ip.of.server /delete
  • ralz
    ralz over 11 years
    Yes i tried net use \\share /u:domain\user password, I get the command completed successfully, i got error before because i made a mistake in my share name, nevertheless even after i get the completed successfully I still get unkown user or bad password when i try to access the share by IP from windows explorer. net session gives me that there is no session with that computer name
  • the-wabbit
    the-wabbit over 11 years
    This is likely to fix the asker's issue. However note that you are not deleting "cached credentials" but connection information in your session - you should update your answer to reduce possible confusion. Killing explorer.exe is rather necessary on newer Windows clients as it seems to hold connections / sessions to the server without them appearing in the "net use" list.
  • Shiro
    Shiro over 11 years
    Thank for the correction. Yes, Windows 7 got this issue hold the connections / sessions. However, it also will auto remove it, but I am not sure the duration. The best way is just kill the explorer. Fast and easy.
  • Drew Chapin
    Drew Chapin almost 11 years
    +1 Restarting the Workstation service was enough to resolve it for me.
  • Talespin_Kit
    Talespin_Kit over 10 years
    restarting is a stupid solution.
  • higuita
    higuita about 10 years
    @Talespin_Kit I agree that it is stupid, but welcome to windows! If you have a better option to clean windows client cache, feel free to post it here. :)
  • Marcos
    Marcos about 10 years
    Thank you! Nowhere in the GUI did Windows 8 make this apparent. Restarting the lanmanworkstation and others in services.msc helped nothing, as neither did restarting smbd, mucking with smbpasswd, etc. on the Linux Samba server.
  • mikebabcock
    mikebabcock about 10 years
    Note that smbstatus on a Linux box will let you see which PIDs go with which users, and you can kill those specifically to disconnect them.
  • Jason
    Jason over 9 years
    Thanks, @druciferre. Workstation restart worked for me on a Windows Server 2012 R2 (i.e., Windows 8.1) install. The NET USE command (my old standby) of course did not.
  • Babblo
    Babblo over 9 years
    +1 for the tip about re-starting explorer.exe
  • MrEdmundo
    MrEdmundo about 9 years
    "In windows server 2012, you might need to restart the Workstation service." - superuser.com/questions/774070/…
  • dhj
    dhj almost 9 years
    This! This should be the accepted answer. No rebooting or kludging around with killing processes in the task manager. Simple and effective.
  • elsadek
    elsadek over 8 years
    "IMPORTANT NOTE" part is the answer.
  • NateJ
    NateJ about 8 years
    I agree -- the Kerberos purge is an effective punch. Just be aware that it's a sledgehammer, i.e. you're killing all of your client's Kerb tickets, not just for that one particular server/share!
  • prot
    prot over 7 years
    You can probably add also /y switch to skip answering the [Y/N] question.
  • Robert Noack
    Robert Noack almost 7 years
    This is the only thing that worked for me.
  • Johu
    Johu about 6 years
    On Windows 8.1 does not work even if I restarted the explorer process. It still remembers the password.
  • Johu
    Johu about 6 years
    The combination of these two commands still does not work on Windows 8.1.
  • Shiro
    Shiro about 6 years
    @Johu this is not about remember password. It removes cached credentials. If you want to remove remember credentials. You should go to Control Panel -> Credentials Management -> Under Windows Credentials remove the record.
  • Johu
    Johu about 6 years
    @Shiro, sure! What I meant by "remembers password" is that it still allows me to visit the share without asking the password again. I am fully aware of the Credentials Manager. Meanwhile I also learned, that instead of restarting explorer.exe in my case I had to wait for 2 minutes for windows to forget the login information.
  • Johu
    Johu about 6 years
    Meanwhile I also learned, that instead of restarting klist purge in my case I had to wait for 2 minutes for windows to forget the login information. I wish there was an instant method.
  • ruslaniv
    ruslaniv over 3 years
    This does not work on Windows 10. All the network connections are still present and accessible in the windows explorer. There is no process called "exporer.exe', but there is "windows explorer.exe'. There are no records associated with network login credentials in the "Control panel' -> 'Manage your credentials' -> 'Windows Credentials'
  • mivk
    mivk over 3 years
    You can also do net use * /delete if you don't want to delete them individually
  • Martin MaKr Kratochvíl
    Martin MaKr Kratochvíl over 3 years
    klist purge - works for me.
  • Shiro
    Shiro about 2 years
    I answer for Windows 7 not for Windows 10. In Windows 10 will be using at Control panel' -> 'Manage your credentials' -> 'Windows Credentials'. And you can Restart the 'Windows Explorer' easily in Task Manager.