When connecting to a server via Explorer (not a mapped network drive) even if the "Remember my credentials" check box is not selected, Windows remembers the password until you log out. Is there any way to switch user/password for a share without logging out and back in?
Are you mapping the share to your system, or merely accessing them directly via My Computer? If you map the drive, then you can chose the link to Connect using a different user name and choose the user/password there. The 'net use' command will also allow you to access a share using alternate credentials, but not sure if it will allow you to browse the share without mapping it using those alternate credentials.
You can override stored credentials for shares in Windows via the Control Panel. I believe this should be possible since around Windows 2000, or at least XP. However, the names of these functions are different in all versions. I am using names from Windows 7 in this post.
Open your account page in User Accounts and Family Safety.
(Click your image in the start menu, or navigate through control panel).
In the left hand side panel, select Manage your credentials.
Under Windows Credentials:
If the server in question has an entry, delete it.
(Most likely it will not be present, if you haven't been here before).
Select Add a Windows Credential.
Enter the server (e.g.
Enter new desired credentials.
Now, when navigating manually to
\\10.0.0.2\myShare, it will not use the old credentials any more.
To delete cached credentials you can follow the below steps.
You can refer the article http://www.morgantechspace.com/2013/07/how-to-clear-windows-cached-credentials.html
Open Run Window by clicking
Start -> Runor click ⊞ Win+R.
In the text box, type the command
rundll32.exe keymgr.dll, KRShowKeyMgrand click OK. Note: You can also type and run this command through Command Prompt.
To remove a saved credential you can select one of the entries and select
Remove. A confirmation screen will appear. Click on
OKand the account will be removed.
You can add additional saved passwords as well by clicking on the
Addbutton and entering the appropriate information.
Thanks everyone here.I wrote a bat script for this purpose and it succeed every time.Tested on Win10 & Win7.
lmhosts services and it worked.
set LoginAccount=USERNAME REM Replace USERNAME by your username set LoginPasswd=PASSWD REM Replace PASSWD by your password set ShareServer=SERVERIP REM Replace SERVERIP by your server's IP or DNS Name REM REM Check if Credential of target Server Exsit cmdkey /list:%ShareServer% | findstr /N ^^ | findstr /V "^[1-2]:" | findstr /I /C:" %ShareServer%" >nul if '%errorlevel%' NEQ '0' ( REM Non Credential of target Server Exsit REM Do nothing ) else ( REM Credential of target Server Exsit REM Delete the Credential cmdkey /delete:%ShareServer% ) REM Add new Credential REM You can found the new Credential in "Control Panel -> Credential Manager" cmdkey /add:%ShareServer% /user:%COMPUTERNAME%\%LoginAccount% /pass:%LoginPasswd% REM Delete All cached Credentials of target Server net use \\%ShareServer% /delete /Y REM Set Relative Services Start Type to Auto sc config LanmanWorkstation start=auto >NUL 2>&1 sc config lmhosts start=auto >NUL 2>&1 sc config netlogon start=auto >NUL 2>&1 sc config sessionenv start=auto >NUL 2>&1 sc config Browser start=auto >NUL 2>&1 REM Restart Relative Services by Powershell powershell -inputformat none -outputformat none -NonInteractive -Command "Restart-Service LanmanWorkstation,lmhosts -Force" REM Make new connection net use \\%ShareServer% "%LoginPasswd%" /user:"%COMPUTERNAME%\%LoginAccount%" REM Open shared folder on Explorer explorer \\%ShareServer%
If you are doing this with a domain account, replace
Access the network share again via name or IP, whichever you haven't already used.
If you connected to
\\192.168.2.10\ with the wrong user you can try again once by using the server name instead. If you open
\\Server\ you'll be prompted for your credentials again. From then on you'll have two open sessions to the same server but with different users. They seem to last until those logins expire which is potentially until the next logout.
Because of this you need to make sure that you're using the right path from now on! if you needed to login to an account with higher permissions to run a backup, make sure your backup tool now works with \Server[path]` and not the IP.
As far as I know this is the workaround that requires the least amount of effort. It's convenient when you want to avoid the hassle of logging in again or mapping a network drive.