Fix it now
Microsoft publishes no meaning for any of the five codes in this family, so the first useful move is to make the machine tell you what it thinks. Then work from how the machine got here – a restored image, a cloned virtual machine or a board replacement – rather than from the code.
slui.exe 0x2a 0xC004E021
slmgr /dlv
slmgr /dli
- Read the text
slui.exe 0x2aprints for the code you actually have, substituting it in the command above. That is Microsoft’s own wording for your build, and it beats any summary. - Note the licence description, channel and partial key from
slmgr /dlv. If they match a different machine, you have your answer. - Work out how this machine got here. A disk clone, a bare-metal restore, a virtual machine deployed from a template, or a replaced motherboard each point somewhere different.
- Where the machine has a digital licence attached to a Microsoft account and the hardware changed, sign in with that account and run the activation troubleshooter, which is offered in Settings under System while Windows is unactivated.
- Where this machine has its own key, install it over the top:
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX, thenslmgr /ato.
Install the correct key over the existing one rather than removing the old one first. Microsoft’s licensing repair guidance says not to use slmgr /upk, and /ipk validates against the installed edition and replaces whatever is there.
If that fixed it you can stop here. If not, the next section covers the three situations that produce this state and the documented store rebuild that clears the rest.
Why it happens
A licensed Windows installation keeps more than a key. Alongside the licence there is protected state that the licensing service maintains and checks before it trusts what it is holding. When something has changed underneath that state – a different machine, different hardware, a copy of somebody else’s installation – the service reports a disagreement rather than picking a winner. That is the family of errors this article covers.
Be clear about the evidence, though. None of 0xC004E021, 0xC004E022, 0xC004E020, 0xC004E00F or 0xC004E010 has a published meaning on learn.microsoft.com or support.microsoft.com. Earlier versions of this article gave each of them a confident description, including a hardware-binding story for 0xC004E00F and 0xC004E010 that no source supports. Those descriptions are gone. What remains is the diagnostic route that actually works, which is to read the machine’s own error text with slui.exe 0x2a and then reason from how the installation was produced.
Three routes account for most of these reports and all three are about copying. A disk imaged from one machine and restored onto another brings the first machine’s licensing state with it. A virtual machine cloned from a template that was never generalised does the same thing at scale, which is why these arrive in batches. And a motherboard replacement changes the hardware the licence was issued against – Microsoft documents that behaviour directly for digital licences, noting that after a significant change such as replacing a motherboard, Windows will no longer find a licence that matches the device.
The fourth possibility is ordinary damage to the licensing store, and Microsoft publishes a rebuild procedure for that, set out in full below. It is the sequence to reach for when no imaging or hardware story explains what you are looking at.
A disk image was restored onto different hardware
You have this one if The machine is a bare-metal restore or a disk clone, and the licence description matches the machine the image came from.
- Confirm this machine has an entitlement of its own before you change anything.
- Install its own key over the inherited one:
slmgr /ipk <key>, thenslmgr /ato. - If licensing operations still fail, run the documented tokens.dat rebuild and install the key again afterwards.
- Confirm
slmgr /dlvnow shows this machine’s partial key rather than the source machine’s.
For repeatable deployment, capture the image after sysprep /generalize. That operation calls slmgr /rearm, which resets the activation timers, so each deployed machine starts its own clock rather than inheriting one.
Virtual machines were cloned from a template that was not generalised
You have this one if A batch of virtual machines all report the same thing, all deployed from one template on the same day.
- Rebuild the template properly, capturing it after
sysprep /generalize. - For machines already deployed, install the intended key on each with
slmgr /ipk <key>and activate withslmgr /ato. - Where volume activation is available, let the machines take activation from the infrastructure rather than typing keys – Active Directory-based activation needs no key on the client beyond its GVLK.
- Confirm each machine reports a distinct licensing state afterwards rather than the same one.
The motherboard or another major component was replaced
You have this one if One machine only, working before a hardware repair and failing immediately afterwards, with no imaging involved.
- If the machine had a digital licence attached to a Microsoft account, sign in with that account and run the activation troubleshooter. Microsoft documents this as the route after significant hardware changes such as a motherboard replacement.
- You must be signed in as an administrator to use the troubleshooter, and it only appears while Windows is unactivated.
- If the machine carries a firmware key, install it and activate.
- If the board was replaced under warranty, ask the manufacturer whether they reprovisioned the licence before you buy one.
The licensing store is damaged rather than mismatched
You have this one if No imaging and no hardware change explains it. The machine simply began failing after a bad update or an abrupt power loss.
- Repair system files:
DISM /Online /Cleanup-Image /RestoreHealth, thensfc /scannow. - Reinstall the licence files:
slmgr /rilc, then restart the licensing service and reboot. - If it persists, run the documented tokens.dat rebuild in full, including the two restarts.
- Install the machine’s own key with
slmgr /ipkand activate.
The key on the machine belongs to somebody else
You have this one if The partial key in slmgr /dlv is not one you recognise, and nobody can say where it came from.
- Establish what this machine is entitled to: a firmware key, a digital licence, or a seat under an agreement.
- Install that entitlement over the top with
slmgr /ipkand activate. - Where none exists, the machine needs a licence of its own and repairs will only postpone the question.
- Record the outcome, because a fleet with one key spread across it will keep producing this.
Full reference
What is actually published about these codes
| Code | Status | What to do with it |
|---|---|---|
0xC004E021 |
No published meaning found | Read the machine’s own text with slui.exe 0x2a 0xC004E021 |
0xC004E022 |
No published meaning found | As above |
0xC004E020 |
No published meaning found | As above |
0xC004E00F |
No published meaning found | As above. The hardware-binding reading given in older guidance is unsourced |
0xC004E010 |
No published meaning found | As above |
That is an uncomfortable table to publish and it is the honest one. The related code Microsoft does document in this range is 0xC004E015, which it attributes to a corrupted tokens.dat and resolves with the store rebuild below. If your machine is producing that one alongside these, start there.
The documented licensing store rebuild
- Stop the service:
net stop sppsvc. - Change to
%windir%\system32\spp\store\2.0on Windows 10, Windows 11, and Windows Server 2016 or later. - Rename the file rather than deleting it:
ren tokens.dat tokens.bar. - Start the service:
net start sppsvc. - Reinstall the licence files:
cscript.exe %windir%\system32\slmgr.vbs /rilc. - Restart the computer twice.
- Install the product key:
cscript.exe %windir%\system32\slmgr.vbs /ipk <product key>.
Microsoft’s instruction alongside that procedure is explicit: never use the /upk switch to uninstall a product key; install the key over the existing one with /ipk. Older guidance for this error opened every remedy with slmgr /upk followed by slmgr /cpky, which leaves the machine unlicensed with nothing to fall back on if the replacement key turns out to be wrong.
What the two slmgr switches actually do
| Switch | Documented behaviour |
|---|---|
/ipk <key> |
Validates the key against the installed OS and, if valid, replaces any existing key. A restart or a Software Protection service restart is recommended afterwards |
/upk |
Uninstalls the product key of the current edition. After a restart the system enters the Unlicensed state unless a new key is installed |
/cpky |
Removes the product key from the registry to prevent theft by malicious code. Best practice for retail key deployments; not required for MAK and KMS host keys |
/rilc |
Reinstalls all licences stored in %SystemRoot%\system32\oem and %SystemRoot%\System32\spp\tokens |
/rearm |
Resets the activation timers. Called by sysprep /generalize. Does nothing if SkipRearm is set to 1 |
Deploying so this does not recur
- Capture reference images after
sysprep /generalizerather than from a machine that has been licensed and used. - For virtual machine templates, generalise the template rather than the clones. Fixing deployed machines one at a time is the expensive version of this.
- Where the estate is domain-joined, Active Directory-based activation removes keys from the client entirely: the client runs its GVLK and takes activation from the forest.
- Keep a record of which entitlement covers which machine. A fleet where nobody can say which key belongs where produces exactly this class of report.
When it is not repairable
If the machine has no entitlement of its own – no firmware key, no digital licence on an account you control, no seat under an agreement – then no sequence of commands creates one. The store rebuild will complete cleanly and the machine will still not be licensed, because there was never a licence for it. That is worth establishing early rather than after three rebuilds.
When a licence is the actual fix
This state is usually a machine running on an entitlement that belongs to something else. If the image came from a computer that keeps its own licence, this one needs a licence of its own, and repairs only postpone the question. A Windows 11 Pro retail key gives the machine an entitlement bound to itself, and being retail it can be moved again if the hardware is replaced later. We supply genuine retail keys and can work out how many you actually need across a set of restored or cloned machines – and whether volume licensing with Active Directory-based activation would be a better fit, because at any scale that removes keys from the clients altogether.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
0xC004E021 |
Reported when the licensing service finds its licence state inconsistent. No published meaning; read the machine’s own text with slui.exe 0x2a | not published by the vendor |
0xC004E022 |
Reported in the same family as 0xC004E021. No published meaning | not published by the vendor |
0xC004E020 |
Reported in the same family as 0xC004E021. No published meaning | not published by the vendor |
0xC004E00F |
Reported in the same family as 0xC004E021. No published meaning; the hardware-binding reading in older guidance is unsourced | not published by the vendor |
0xC004E010 |
Reported in the same family as 0xC004E021. No published meaning | not published by the vendor |
Confirm the fix worked
slmgr /dlvreports a licence status of Licensed with the partial key that belongs to this machine.- Settings, System, Activation reports the machine as activated, with no Troubleshoot option offered.
- On a set of cloned machines, each one reports a distinct licensing state rather than the same one.
- The Application log under Security-SPP stops recording licensing failures.
- Reboot and re-check, since a mismatch often reappears at the next validation cycle rather than immediately.
Questions people ask about this
Can I copy a licensed machine’s disk to a new PC?
Not and expect it to stay licensed. The licensing state travels with the image and stops matching the new machine. Generalise the image before capture, or license each machine individually.
Does sysprep fix a machine that is already deployed?
That is not its purpose. sysprep /generalize prepares an image before capture, and it is documented as calling slmgr /rearm to reset the activation timers. On a machine already in service, installing the correct key with /ipk is the predictable route.
Why does the article not tell me what 0xC004E021 means?
Because no acceptable source publishes a meaning for it. Run slui.exe 0x2a 0xC004E021 on the machine and you will get Microsoft’s own wording for your build, which is better than a description someone reverse-engineered from a plausible story.
Do I have to buy a licence for every restored machine?
Every machine needs an entitlement, but you may already hold them. Check firmware keys, digital licences on accounts you control, and existing agreements first. Buying applies to machines with no entitlement, not to machines whose licence merely needs reapplying.
Why did it work for a while before failing?
Because activation can succeed on copied state before the next validation cycle catches up with it. The inconsistency was there from the moment the image landed; it simply took a check to surface it.
