Windows activation error 0x80070520 usually means the system cannot validate your product key due to a corrupted activation cache or a permissions problem. The most reliable fix is to reset the Windows activation timer and re-enter your key from an elevated Command Prompt, which resolves the issue in most cases.
What This Error Means
Error 0x80070520 appears when you try to activate Windows 10 or Windows 11, either through Settings or the activation troubleshooter. The code itself translates to “STATUS_INVALID_IMAGE_HASH,” which in this context means the activation service detected a mismatch between the files it uses to verify your license and what is actually on your system. This is rarely a problem with your product key itself; more often it is a corrupted Tokens.dat file, a broken Windows Update component, or a permissions conflict in the Software Protection service.
You will typically see a dialog box that says “We can’t activate Windows on this device” with the error code underneath. The system may also show this error after a major update, a hardware change, or a failed attempt to transfer a digital license. Understanding that the key is usually fine is important, because it means you should not buy a new license until you have tried the fixes below.
Why It Happens
Windows stores activation information in a file called Tokens.dat located in C:\Windows\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\. This file contains the digital license and product key data that the Software Protection service reads every time you activate. If this file becomes corrupted, or if the service cannot access it due to incorrect permissions, Windows throws error 0x80070520.
Common triggers include:
- Interrupted Windows updates that leave activation components in a partial state.
- Third-party system cleaners that mistakenly delete or modify activation files.
- Malware or antivirus software quarantining parts of the activation system.
- Manually editing the registry or using unofficial “KMS” scripts that break the license cache.
- Restoring a system image from a different computer or a failed disk clone.
In rare cases, the error appears after a motherboard or hard drive replacement, even though the digital license is tied to your Microsoft account. The system then tries to reactivate but cannot read the old tokens, producing the same code.
Before You Start
Make sure you have your product key or know that the device has a digital license. If Windows came preinstalled on your computer, the key is usually embedded in the UEFI firmware, and you do not need to enter it manually. To check whether a digital license is present, go to Settings > System > Activation. If it says “Windows is activated with a digital license,” you can skip entering a key and just run the troubleshooter after resetting the cache.
If you have a retail or OEM product key, write it down or keep it in a safe place before making any changes. You can find your current key with the command wmic path softwarelicensingservice get OA3xOriginalProductKey in Command Prompt, but that only works if the key is still present in the system.
Fix 1: Reset the Activation Cache
This is the most direct fix and resolves the error for the majority of users. It clears the corrupted Tokens.dat file and forces Windows to rebuild it from scratch.
- Open Start, type
cmd, right-click Command Prompt, and select Run as administrator. - Type the following commands one by one, pressing Enter after each:
net stop sppsvc
cd /d %SystemRoot%\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\
ren Tokens.dat Tokens.bat
net start sppsvc
This stops the Software Protection service, renames the old token file (so you can restore it if needed), and restarts the service. Windows will create a new Tokens.dat automatically.
Now go to Settings > System > Activation and click Activate. If it asks for a key, enter it. If you have a digital license, it should activate without further input. If the error persists, reboot and try again.
Fix 2: Run the Activation Troubleshooter
Windows includes a built-in troubleshooter that can detect and fix common activation problems. After resetting the cache, run it:
- Go to Settings > System > Activation.
- Click Troubleshoot (or Activation troubleshooter).
- Select I changed hardware on this device recently if you did, then sign in with your Microsoft account.
- Follow the on-screen prompts. The troubleshooter may ask you to select the device you are using now.
This tool is particularly useful if you recently replaced a motherboard or hard drive and the digital license is linked to your Microsoft account. It will transfer the license to the current hardware.
Fix 3: Repair Windows Update and System Files
Sometimes the error is caused by corrupted system files that affect activation. Run the System File Checker and the Deployment Image Servicing and Management tool to repair them.
- Open Command Prompt as administrator.
- Run
sfc /scannowand wait for it to finish. This checks and repairs protected system files. - Then run
DISM /Online /Cleanup-Image /RestoreHealth. This repairs the Windows image itself. - Restart your computer and try activation again.
If the error persists after these steps, the issue may be with Windows Update itself. Stop the Windows Update service, delete the software distribution folder, and restart the service:
net stop wuauserv
net stop bits
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
net start wuauserv
net start bits
Then run Windows Update and attempt activation again.
Fix 4: Re-enter Your Product Key
If the above fixes do not work, try manually re-entering your product key. This can refresh the activation data even if the key appears correct.
- Open Command Prompt as administrator.
- Type
slmgr /ipk YOUR-PRODUCT-KEY(replace with your actual key, including dashes) and press Enter. - You should see a message saying the key was installed successfully.
- Then type
slmgr /atoto force activation.
If you do not have a key but the system has a digital license, you can use slmgr /ato alone to attempt activation. This command tells Windows to use the embedded or digital license.
When All Else Fails
If none of the fixes work, the problem may be a deeper issue with your Windows installation. Consider these options:
- Perform a repair install using the Windows Media Creation Tool. This reinstalls Windows while keeping your files and apps. It often resolves stubborn activation errors.
- Contact Microsoft Support through the Get Help app or the activation support page. They can verify your license and may provide a replacement key if yours is invalid.
- Check if your key is genuine. If you bought a key from an unauthorized reseller, it may have been revoked. Microsoft will not activate such keys, and the error may be a sign of that.
Do not attempt to use third-party activation tools or “KMS” cracks. They can cause this exact error and may introduce malware. Always use official methods.
Frequently Asked Questions
Will I lose my files if I reset the activation cache?
No. Renaming Tokens.dat only affects activation data. Your personal files, applications, and settings remain untouched. The system will rebuild the token file automatically.
Can I fix this without a product key?
Yes, if your Windows has a digital license (common on prebuilt PCs). Run the activation troubleshooter and sign in with your Microsoft account. The system will recognize the license and activate without a key.
Why does the error appear after a hardware change?
Windows ties the digital license to your hardware ID. When you change a major component like the motherboard, Windows sees a new device and tries to reactivate. The old token file may not match, causing error 0x80070520. The troubleshooter is designed to fix this.
Is it safe to use the slmgr commands?
Yes. slmgr is a built-in Windows tool for managing licenses. The commands listed above are standard and used by Microsoft support. Do not use any slmgr commands you do not understand, and always run them as administrator.
How long does the fix take?
Resetting the cache takes about five minutes. Running SFC and DISM can take 15–30 minutes depending on your system speed. The repair install takes about an hour but is the most thorough option.
What if the error returns after a few days?
If the error reappears, it usually means the token file is being corrupted repeatedly. This can be caused by aggressive antivirus software or a failing hard drive. Run a disk check (chkdsk /f) and temporarily disable any system cleaners to see if the issue stops.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Windows 11 Search: Customize & Use It Fully
- PL2303 Driver Windows 11 Install Guide
- Multiple Linux Desktop Environments: Can You Run Them?
- Create Administrator Account in Windows 10: 5 Ways
- Browser Automation Scripts: Step-by-Step Guide
- Fix Camera App Error 0x200f4246 0x80040154