DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
There is a known issue where the DISM RestoreHealth command appears to get stuck at 62.3%. However, if the logs are tailed, you can see that the process is actively continuing.
In an elevated PowerShell terminal, the below command can be run. Once the log shows Ending TrustedInstaller finalization, then DISM is complete.
Get-Content C:\Windows\Logs\CBS\CBS.log -tail 10 -wait
I was experiencing an issue with a my Windows 11 computer showing it was inactivated every day. I was able to temporarily clear this by running the command slmgr /ato. I noticed that the Software Protection Service (SPPSVC) was not started, but when I manually started it, it kept stopping on its own. I tried both sfc /scannow and DISM /Online /Cleanup-Image /RestoreHealth with no change. I even did an in-place upgrade which also had no affect.
When looking at event logs at Windows Logs > Application, I saw event 16394 triggered when I started SPPSVC which said Offline downlevel migration succeeded. Then event 16384 was triggered which said Successfully scheduled Software Protection service for re-start at 2125-10-15T05:30:00Z. Reason: RulesEngine.
This means that the RulesEngine determined that SPPSVC should not remain active so it schedules a restart for 100 years in the future. This can be due to a date/time mismatch, KMS/license mismatch, or corrupted licensing store. In my case, it seemed to be the third option as the time was synced and I had a retail license, not a KMS license.
At this point, things went wrong due to some bad instructions. I deleted the licensing store which resulted in not being able to reinstall my license. This is because my license was an Upgrade License and Windows thought I was trying to do a clean install since the previous license was missing. Luckily, I was able to copy the old licensing store from C:\Windows.old.
Do not delete the licensing store at C:\Windows\System32\spp\store.
After restoring the old licensing store, I ran slmgr /ipk <license key> followed by slmgr /ato. This successfully activated Windows and when I looked at the event logs again, event 16384 showed that SPPSVC would restart in 24 hours instead of 100 years.
If I come across this issue in the future, I think these steps would resolve it:
net stop sppsvc
cd C:\Windows\System32\spp\store\2.0
takeown /f tokens.dat
icacls tokens.dat /grant administrators:F
ren tokens.dat tokens.bad
net start sppsvc
slmgr /ato
If that doesn't work then I would try adding slmgr /ipk <license key> before slmgr /ato.