How do I reconnect to a UNC share using different credentials

You may be able to clear the cached credentials by using the Credential Manager in the Control Panel.

Try browse into the Control Panel, enter "Credential Manager" into the search bar on the top right, then click on the "Credential Manager" result. You may find your cached credentials under the "Windows Credentials" section, if so you can click "Remove from vault" to clear them.


Just to add to the confusion, in Windows 7 (Vista and later actually), a regular command prompt maintains a separate set of mapped drives and credentials when compared to an elevated (run as administrator) command prompt. So if you map a drive with an elevated command prompt, it won't be visible in a regular (non-elevated) command prompt.

More info here: http://technet.microsoft.com/en-us/library/ee844140(v=ws.10).aspx


Once connected, either as a network drive, a typed UNC path or by browser navigation, windows remembers the credentials for that connection as long as you stay logged on. This is particularly annoying if the server accepts anonymous logons for access but none-anonymous credetials for other operations.

To discard the connection without the need to logoff or reboot, I wrote a VBS script. Paste the following code in notepad an save it as a .VBS file. Run this code by double-clicking the file. The old credentials will be released giving you the opportunity to connect with other credentials.

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections
If (oDrives.Count = 0) And (oPrinters.Count = 0) Then MsgBox "There are no mapped drives or printers", vbOkOnly, "Network mappings"
For i = oDrives.Count - 2 To 0 Step -2
  If oDrives.Item(i) = "" Then
    msg = "Network Drive" & vbCr & "(No drive letter)" & vbCr & oDrives.Item(i+1)
  Else
    msg = "Network Drive" & vbCr & oDrives.Item(i) & vbCr & oDrives.Item(i+1)
  End If
  Answer = MsgBox(msg & vbCr & vbCr & "Disconnect?", vbYesNoCancel + vbQuestion, "Network drive mappings")
  If Answer = vbCancel Then WScript.Quit
  If Answer = vbYes Then WshNetwork.RemoveNetworkDrive oDrives.Item(i+1)
Next
For i = oPrinters.Count - 2 To 0 Step -2
  msg = "Printer Connection" & vbCr & oPrinters.Item(i) & vbCr & oPrinters.Item(i+1)
  Answer = MsgBox(msg & vbCr & vbCr & "Disconnect?", vbYesNoCancel + vbQuestion, "Network printer mappings")
  If Answer = vbCancel Then WScript.Quit
  If Answer = vbYes Then WshNetwork.RemovePrinterConnection oPrinters.Item(i+1)
Next

Hope this helps you!

Elmer.