11

I connected to my NAS using windows explorer, by entering \\DS412 in windows explorer. It prompted me for a username and password. I entered them and then the DS412 showed up under Network in Explorer. Worked fine.

The share was listed by NET USE and I used this command to disconnect:

NET USE \\DS412\IPC$ /DELETE

And that worked fine. Once.

I then reconnected using username and password, this time I checked the box to remember these credentials. Worked fine.

Now I again want to connect as another user. So I would like to disconnect from \\DS412 and reconnect using different credentials.

I tried using NET USE, but it no longer lists the \\DS412. Entering NET USE \\DS412\IPC$ /DELETE again results in The network connection could not be found.

Restarting the computer does not help. The \\DS412 does not automatically show up under Network in Explorer, but if I do enter \\DS412 in the Explorer bar, it immediately reconnects using my old credentials without prompting.

Note that I am not mapping this UNC path to any drive letter. I have found this advice, but as you can see it does not help. I have found suggestions to use regedit, but I do not find the exact keys suggested, and I would really prefer not to hack the registry. This should be doable using command line commands?

I am running Windows 7.

Klas Mellbourn
  • 347
  • 1
  • 5
  • 10

4 Answers4

11

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.

Craig Dodd
  • 156
  • 1
  • 2
2

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

John Homer
  • 1,293
  • 10
  • 10
1

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.

Elmer
  • 11
  • 1
0

After doing

net use * /delete

(or some specific net use \\server\IPC$)

you also need to purge the Kerberos ticket cache:

klist purge
mivk
  • 3,457
  • 1
  • 34
  • 29