Clear "session" in network shared folder without logging out

Discussion in 'Windows 10' started by sacarias, Feb 26, 2022.

  1. sacarias

    sacarias MDL Member

    Nov 21, 2018
    110
    1
    10
    There's a file server in office.
    When doing tests I access it by running (Win + R) "\\server_name", then opening shared folder.
    If it's the first time after logging in to Windows desktop, it asks for username and password; not anymore afterwards.

    But sometimes I need to switch users because different folders have different permissions. The thing is, to do this correctly, I need to "close" current session to "log in" with another user. To do this I always need to log out from Windows desktop and log in back again.

    At long term it becomes tiring, and sometimes it's even impractical. So, after an internet search, I tried checking Windows credential manager, but there's nothing saved there. I also tried command "net use * /d", but although it shows a "succeed" message and "net use" shows no stored connections anymore, "session" is still there in the shared folders. I still can browse the ones I was browsing without password prompt, and cannot browse other ones. I have to log out and back in.

    Am I doing something wrong?
    Thanks beforehand.
     
  2. kaljukass

    kaljukass MDL Guru

    Nov 26, 2012
    3,451
    1,345
    120
    You will probably see cached snapshots, and restarting explorer.exe will usually help you get rid of it.
    Code:
    @echo off
    taskkill /f /IM explorer.exe
    start explorer.exe
    exit
    
    Recommended run as administrator.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. sacarias

    sacarias MDL Member

    Nov 21, 2018
    110
    1
    10
    Sorry, didn't work. No effect at all. Also ran as administrator.
     
  4. GrofLuigi

    GrofLuigi MDL Senior Member

    Sep 17, 2016
    301
    782
    10
    h_ttps://old.reddit.com/r/windows/comments/994mcf/closing_smb_session_on_windows_client/

    ?
     
  5. sacarias

    sacarias MDL Member

    Nov 21, 2018
    110
    1
    10
    Thanks.
    That seems to be the issue.

    Command "net use" does work, but seems to come with a hard-coded delay of circa 12-15 seconds by default, unless applying the suggested "trick" there...