KMS Client Cache

I came across an issue where one of our AD/DNS Servers inherited a .srv record (dont know how) to advertise that it was a KMS server. We provisioned some Server 2012R2 servers and couldnt activate. The error on the logs was:
License Activation (slui.exe) failed with the following error code:
hr=0xC004F038

This error code means that the KMS server doesnt have enough activations on it to activate further clients.. In order to recitify our issue, firstly deleted the .srv txt key on the DNS server that was advertising the wrong KMS key, then used clear KMS host command, not sure if needed a reboot, I did anyways since it was a non-production, vanilla install.

I found some handy commands that will enable you to flush the cache on a KMS Client.
Useful KMS and Windows activation commands:
Change Windows 2008 R2 license key type from Retail to KMS activated:
Slmgr /ipk 489J6-VHDMP-X63PK-3K798-CPX3Y
Clear cached KMS host:
Slmgr.vbs /ckms
Disable KMS host caching:
Slmgr.vbs /ckhc
Flush local system DNS cache:
Slmgr.vbs /flushdns
Force immediate activation:
Slmgr.vbs /ato
Enable KMS Host caching:
Slmgr.vbs /skhc
Point activation to a specific KMS Server (disables KMS autodiscovery via DNS):
Slmgr.vbs /skms:SERVER
Display detailed license information (& KMS Host Info):
Slmgr.vbs /dlv
Get information about OS activation from KMS Server:
slmgr.vbs / dli
Configure a server to run KMS:
Install the KMS activation key by running the following:
slmgr.vbs /ipk
Run the following command to immediately activate:
slmgr.vbs /ato
Restart the Software Licensing Service (SPPSVC):
net stop sppsvc && net start sppsvc
http://technet.microsoft.com/en-us/library/ff793407.aspx
The Software Licensing Service (SPPSVC) handles registration of the DNS service (sRV) record which is created in the same DNS domain the KMS host is installed uder the _tcp subzone.
KMS will automatically handle activations for systems in the same DNS Domain. In order to expand the scope to other domains, a registry hack is required.
Open Regedit and navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform
Create a new Multi-String key called DnsDomainPublishList
Edit the key and add each additional DNS domain suffic that KMS should publish to on a separate line.
Restart the Software Licensing Service (SPPSVC):
net stop sppsvc && net start sppsvc
If Dynamic DNS is not enabled for your AD domain, you will have to manually add the SRV record for KMS with ths following information:
Service: _VLMCS
Protocol: _TCP
Port Number: 1688
Host:
http://technet.microsoft.com/en-us/library/ff793405.aspx
Note: Only the first KMS Host can create an SRV record – subsequent KMS Hosts cannot change or update SRV records unless the default DNS permissions are modified.
Configuring KMS Clients:
Manually specify a KMS Host:
slmgr.vbs /skms : NOTE: When you manually specify a KMS host, this disables automatic discovery of the KMS host.
Enable Auto-discovery:
slmgr.vbs /ckms
Change a client from retail to volume activation:
Slmgr.vbs /ipk
Change a client registered with a MAK key to KMS:
slmgr.vbs /ipk
KMS Setup Keys:
Windows 7 Professional: FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
Windows 7 Professional N: MRPKT-YTG23-K7D7T-X2JMM-QY7MG
Windows 7 Enterprise: 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
Windows 7 Enterprise N: YDRBP-3D83W-TY26F-D46B2-XCKRJ
Windows 7 Enterprise E: C29WB-22CC8-VJ326-GHFJW-H9DH4
Windows Server 2008 R2 HPC Edition: FKJQ8-TMCVP-FRMR7-4WR42-3JCD7
Windows Server 2008 R2 Datacenter: 74YFP-3QFB3-KQT8W-PMXWJ-7M648
Windows Server 2008 R2 Enterprise: 489J6-VHDMP-X63PK-3K798-CPX3Y
Windows Server 2008 R2 for Itanium-Based Systems: GT63C-RJFQ3-4GMB6-BRFB9-CB83V
Windows Server 2008 R2 Standard: YC6KT-GKW9T-YTKYR-T4X34-R7VHC
Windows Web Server 2008 R2: 6TPJF-RBVHG-WBW2R-86QPH-6RTM4

Compliments of site:

KMS Part 2