Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Related: How can I enable domain authentication over wireless in Windows 7/2k8?

To test the domain login over wireless connection feature I'm trying to set up in the above question, I need an account that hasn't had its domain credentials cached on the local system. Unfortunately, there's only so many people in my office who might help me test this, and even then I'd rather not bother them for it. So, I'd like to be able to clear my own cached credentials after each login.

How can I clear the local cache, while still retaining the ability to cache credentials in the future?

share|improve this question
add comment

4 Answers

up vote 5 down vote accepted

David Yu's answer is pretty much on-target, but there is a way to do this without editing the registry directly. Again though, this will only work if the setting is not configured by GPO.

First, I'd like to point out where the cached credential data is stored. This will help demonstrate (and, for troubleshooting purposes, verify) the effect of the configuration changes.

WARNING: I found this information in several places on the Internet, most of which recommended against modifying these values manually.

The registry key that stores cached domain logins is hidden even from Administrators. It is only accessible by the SYSTEM account. Therefore, to view it you will need a tool like psexec (available from Microsoft, but not installed by default) which will allow you to run regedit as SYSTEM. The command line to do this (assuming it is installed, and in your %PATH%) is:

psexec -d -i -s regedit

Once you're in there, navigate to HKLM\SECURITY\Cache\. Here, you should see several BINARY values. There will be one named NL$Control, and others named NL$## for each slot that you have available for cached credentials. (Default 10)

HKLM\SECURITY\Cache on Server 2003

Again, I want to emphasize here that you should not manually modify or delete this key or its values.

So, now that we know where the data is cached, and that we should not touch it there, how do we clear it?

Again, David Yu's answer will point you to the right registry key. But, if you'd rather not modify the registry directly, there is another way to do this via the Local Security Policy.

secpol.msc

In the Security Settings tree, navigate to Local Policies\Security Options. Here will be a policy called Interactive logon: Number of previous logons to cache (in case domain controller is not available).

Local Security Policy on Server 2003

By default this is set to 10 logons. To clear the cache, set it to zero and click OK. On Server 2008, this will take effect immediately. For Server 2003, you will need to reboot. The affect can be seen in HKLM\SECURITY\Cache\ where there will no longer be any NL$## values.

Cleared credential cache on Server 2003

To re-enable credential caching, edit the same Policy to reflect your preferred value and hit OK. Again, if you're on Server 2008, this will take effect immediately. Server 2003 will require a reboot. Note that, if you are doing this on Server 2008 and you have not logged off or rebooted yet, you can see that the cache slots have been restored but no actual data is in them.

Empty credential cache slots on Server 2008

Doing this without logoff or reboot in Server 2008 can be useful if you want to just do a quick, one-time check of whatever function requires temporarily-disabled credential caching. It also helps ensure you don't forget to revert the change after your next login.

share|improve this answer
add comment

You could modify the registry of the system to disable cached logon credentials. Set the registry key to 0. This will require a reboot after each change. This also assumes you don't have a GPO that sets this key.

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\Winlogon\

ValueName: CachedLogonsCount

Data Type: REG_SZ

Values: 0 - 50

share|improve this answer
    
Keep in mind that this change would have to be reverted later, if you want to retain credential caching after testing is done. Reverting the change will not restore old cached credentials, but it will allow you to cache new logons. –  Iszi Mar 29 '12 at 20:50
    
I fear David's answer is the best you can get. There doesn't seem to be a way to "clear" cached domain logons for a single user other than by disabling them altogether by setting this registry value to 0. –  Yanick Girouard Mar 30 '12 at 1:03
    
@YanickGirouard There is an easier way, which doesn't require a reboot or raw registry edit - at least, not on Server 2k8. I'd already figured it out by the time I posted this question, but thought I'd give some time for someone else to post it. If nobody else has done so, I'll probably post my answer later today. –  Iszi Mar 30 '12 at 6:54
    
Please do post your answer and accept it as soon as you can. That's what these forums are all about: sharing knowledge! Thank you :) –  Yanick Girouard Mar 30 '12 at 12:21
    
@YanickGirouard That's why I posted this thread, so that the knowledge could be shared. I like to share the rep too though, if anyone cares to take the opportunity. I'm gathering screenshots for my answer now. –  Iszi Mar 30 '12 at 13:59
add comment

The way to modify cached credentials stored is (oddly enough) by modifying the security options\Interactive logon: Number of previous logons to cache policy via group policy editor (gpedit)

share|improve this answer
add comment

The handiest way to remove stored credentials is to run MSTSC and enter the name or ip address of the terminal server that is cached. If it was cached as the fully qualified domain name, that is what you must enter, it will likely fill the field in for you as well as your domain\username. Then click Options. If credentials are stored, you may edit or delete them.

To keep the system from cacheing credentials, edit the RDP file with notepad and change the PromptCredentialOnce:i:1 parameter to PromptCredentialOnce:i:0

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.