Fix it now
Microsoft publishes 0xC004E002 as “the license store contains inconsistent data”, and gives the cause as wrong permissions on the Tokens.dat file or that file being corrupted. Fix the permissions first. Only rebuild the file if that does not clear it, and only after you know how this machine is licensed.
slmgr /dli
icacls "%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\WSLicense" /grant "BUILTIN\Administrators:(OI)(CI)(F)" "NT AUTHORITY\SYSTEM:(OI)(CI)(F)" "NETWORK SERVICE:(OI)(CI)(F)"
slmgr /dlv
- Record the channel and the last five characters of the key from
slmgr /dlibefore touching anything. That is what you are recovering to. - For a firmware OEM key, read it now with
(Get-CimInstance -ClassName SoftwareLicensingService).OA3xOriginalProductKeyin elevated PowerShell. - If activation rests on a digital licence, open Settings, System, Activation and link it to a Microsoft account before you go further.
- The icacls command is Microsoft’s documented permission repair for Windows 8 and Windows Server 2012 onwards. Older releases use a different folder, listed in the reference section.
- If the permission repair does not clear it, move to the documented rebuild: stop
sppsvc, rename tokens.dat, startsppsvc, then runslmgr /rilcand restart the computer twice.
If slmgr /dlv now returns a full status you are done. If it still reports a store error, the next section explains what the store holds and which part of it is failing.
Why it happens
Windows does not keep your entitlement as a product key in the registry. It keeps a set of signed licence files, plus a token store the Software Protection service loads them into at runtime. The service reads that set, evaluates it as a whole and produces the single answer the Activation page shows you. 0xC004E002 is the service saying that what it read does not hold together.
The cause Microsoft publishes for this code is narrower than most treatments of it suggest, and it is worth taking literally: incorrect permissions on the Tokens.dat file, or a corrupted Tokens.dat. Permissions come first in Microsoft’s own resolution, and they are the cheapest thing to check, because fixing them changes nothing about your licences.
That ordering matters commercially as well as technically. Repairing the store does not repair your entitlement, because your entitlement was never damaged. A retail key can be reinstalled, an OEM key sits in firmware, a volume machine re-activates against its own infrastructure, and a digital licence linked to a Microsoft account can be reclaimed. What you must not do is start renaming files before you know which of those describes this machine, because the one route that cannot be recovered is an unlinked digital licence on a machine whose key nobody wrote down.
The other five codes in this article are a different matter. Microsoft publishes no description for 0xC004E003, 0xC004E011, 0xC004E00E, 0xC004E012 or 0xC004E013 on any support or documentation page. They come from the same part of the licensing service and they respond to the same repair, but nobody outside Microsoft can tell you precisely what each one is checking. Read the text your own machine holds with slui.exe 0x2a <code>.
Permissions on the licence store folder are wrong
You have this one if The service starts, the store still fails to load, and the Application log records access failures against the licensing path.
- Run the documented icacls grant for your Windows generation, from the reference table below.
- Restart the machine, then run
slmgr /dlv. - If a hardening baseline tightened the permissions, exempt this path in the baseline or it will tighten them again.
This is Microsoft’s first documented method for the code and it is non-destructive. Try it before anything that renames a file.
Tokens.dat itself is corrupted
You have this one if Permissions are correct and the store still will not load; the failure survives a reboot.
- Stop the service:
net stop sppsvc. - Change to the store folder for your Windows generation and rename the file:
ren tokens.dat tokens.bar. - Start the service:
net start sppsvc. - Reinstall the licence files:
cd %windir%\System32thencscript slmgr.vbs -rilc. - Restart the computer twice. Microsoft’s procedure says twice, and it is not a rounding error.
Rename rather than delete. The renamed file is your way back if the rebuild leaves the machine worse than it started.
The Software Protection service is not running at all
You have this one if You also see 0x80070422 or 0x80070426, which are service errors rather than store errors.
- Check the configuration:
sc qc sppsvc, then the state:sc query sppsvc. - Restore the start type if it is disabled:
sc config sppsvc start= delayed-auto, thennet start sppsvc. - Only then look at the store. A store error reported by a service that never started tells you nothing.
The component store underneath is damaged
You have this one if slmgr /rilc fails or changes nothing, and Windows Update has also been failing on this machine.
- Repair the component store:
DISM /Online /Cleanup-Image /RestoreHealth. - Then repair system files from it:
sfc /scannow. - Reboot and run
slmgr /rilcagain. - Reinstall the key if it is gone, and activate.
DISM first, sfc second. sfc repairs from the component store, so a damaged store gives it nothing good to copy.
The machine was imaged from a source captured mid-servicing
You have this one if Every machine from one image reports the same code, and a machine built by hand from the same media does not.
- Rebuild the reference image and let servicing finish before capture.
- Generalise it with
sysprep /generalize, which Microsoft documents as calling the same rearm that resets licensing state. - For machines already deployed, work through the permission repair and then the rebuild.
Full reference
Where the store lives, by Windows generation
| Windows generation | Licence store folder |
|---|---|
| Windows 8, Windows Server 2012, Windows 8.1, Windows Server 2012 R2 and later | %windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\WSLicense |
| Windows 7, Windows Server 2008 R2 | %windir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform |
| Windows Vista, Windows Server 2008 | %windir%\serviceprofiles\networkservice\appdata\roaming\microsoft\softwarelicensing |
The service name changed with the folder. Vista and Server 2008 use slsvc; everything from Windows 7 onward uses sppsvc. If a set of instructions tells you to stop slsvc on a current machine, it was written for a product that left support a long time ago and the rest of it is likely to be equally stale.
Establishing what you are recovering to
What slmgr /dli reports |
How the machine gets back afterwards |
|---|---|
| A retail channel | Reinstall the key with slmgr /ipk and activate online |
| An OEM channel | Read the firmware key with the SoftwareLicensingService query, or let setup pick it up |
| A KMS client channel | Re-activate against the KMS host or the directory activation object. There is no key to find |
| A digital licence with no key shown | Link it to a Microsoft account first, then reclaim it after the rebuild |
| Nothing readable at all | Fix the Software Protection service before touching the store |
What slmgr /rilc actually does
Microsoft describes it as reinstalling all licences stored in %SystemRoot%\system32\oem and %SystemRoot%\System32\spp\tokens, which are known-good copies kept during installation. Matching licences in the trusted store are replaced; additional licences, such as those belonging to applications, are left alone. It must be run from an elevated Command Prompt.
That description explains both why it is the right second step and why it is not magic. It restores what installation put there. If the installation media, the servicing history or the disk underneath is the problem, /rilc reinstates the same set that failed, and the fault comes back.
Do not delete the licence store folder, and do not follow instructions that tell you to remove the whole spp directory. On a machine relying on a digital licence you have not linked to a Microsoft account, that turns a recoverable fault into one you have to buy a key for.
The five codes with no published meaning
| Code | What can honestly be said |
|---|---|
0xC004E003 |
No published description. Appears in the same store family as 0xC004E002 and responds to the same repair |
0xC004E011 |
No published description |
0xC004E00E |
No published description |
0xC004E012 |
No published description |
0xC004E013 |
No published description |
Read the vendor’s own text for any of them with slui.exe 0x2a 0xC004E003 and the code you have. That prints what Windows holds, which is a better basis for a decision than a sentence someone wrote to make an article flow.
When the store keeps breaking
- Check the disk. A store that corrupts, is rebuilt, and corrupts again is a storage symptom, not a licensing one.
- Check what else opens files under the Windows directory: backup agents, indexers and endpoint protection all hold files open.
- Check whether the machine is being imaged from a source that was captured without generalising.
- If the machine has also had file system errors or failed updates, treat the hardware as the prime suspect and stop repairing the licensing platform.
When a repair install is the reasonable answer
An in-place upgrade that keeps files and applications rebuilds the store cleanly, and it is a legitimate last resort once the permission repair, the tokens.dat rebuild and the component store repair have all been tried. It is a last resort rather than a second step: it takes hours, it needs matching media, and it does nothing that the documented repairs would not have done if the underlying fault were in the store. Back up first.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
0xC004E002 |
The licence store contains inconsistent data. Microsoft’s documented cause is wrong permissions on Tokens.dat, or a corrupted Tokens.dat | Microsoft Learn |
0xC004E003 |
Returned from the same licence-store family. No published description; read the machine’s own text with slui.exe 0x2a | not published by the vendor |
0xC004E011 |
Same family, no published description | not published by the vendor |
0xC004E00E |
Same family, no published description | not published by the vendor |
0xC004E012 |
Same family, no published description | not published by the vendor |
0xC004E013 |
Same family, no published description | not published by the vendor |
Confirm the fix worked
slmgr /dlvreturns a complete status rather than a store error.- The licence status reads Licensed and the channel matches what you recorded from
slmgr /dlibeforehand. - Settings, System, Activation agrees with what slmgr reports.
- You have restarted twice, as Microsoft’s procedure requires, and the state held across both restarts.
- The renamed tokens.bar file is still on disk until you are satisfied, and only then deleted.
Questions people ask about this
Will rebuilding the store cost me my activation?
Not if you prepare. Record the channel and partial key with slmgr /dli, read a firmware OEM key with the SoftwareLicensingService query, and link a digital licence to a Microsoft account before you start. The risk is not the file, it is not knowing what the file held.
Should I try slmgr /rilc first?
No. Microsoft’s documented resolution for this code starts with the permissions on Tokens.dat, then the rename, and only then /rilc. Running /rilc first is not harmful, but it skips the cause the vendor actually names.
Why does Microsoft say to restart twice?
That is what the published procedure says, at the end of the tokens.dat rebuild. Licensing state is re-evaluated at service start, and a single restart is not always enough for the rebuilt store to settle. Do both before deciding the repair failed.
Does any of this cost money?
No. Every step is a repair built into Windows and none of them touches your entitlement. This becomes a purchase only if the machine never had a valid licence in the first place, which slmgr /dli will tell you before you start.
What do the other five codes mean?
Nobody outside Microsoft can tell you, because Microsoft does not publish descriptions for them. Run slui.exe 0x2a with the code to read what your machine holds. In practice they respond to the same repair as 0xC004E002, which is the one with a documented cause.
