How to rebuild the Tokens.dat file when you troubleshoot Windows activation issues

This article provides a solution to an issue that you may rebuild the Tokens.dat file when you troubleshoot Windows activation issues.

Original product version:   Windows 10 - all editions, Windows Server 2012 R2, Windows Server 2019, Windows Server 2016
Original KB number:   2736303

Summary

When you troubleshoot Windows activation issues, you may have to rebuild the Tokens.dat file.

Resolution

To rebuild the Tokens.dat file, follow these steps:

  1. Open an elevated command prompt:

    1. Swipe in from the right edge of the screen, and then tap Search. Or, if you're using a mouse, point to the lower-right corner of the screen, and then select Search.
    2. In the search box, type cmd.
    3. Swipe across or right-click the displayed Command Prompt icon.
    4. Tap or select Run as administrator.
  2. Type the following commands in the order in which they're presented. Press Enter after each command.

    1. net stop sppsvc

    2. For Windows 10, Windows Server 2016 and later versions of Windows:
      cd %windir%\system32\spp\store\2.0

      For Windows 8.1, Windows Server 2012 and Windows Server 2012 R2: cd%windir%\ServiceProfiles\LocalService\AppData\Local\Microsoft\WSLicense

      For Windows 7, Windows Server 2008 and Windows Server 2008 R2:
      cd%windir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform

    3. ren tokens.dat tokens.bar

    4. net start sppsvc

    5. cscript.exe %windir%\system32\slmgr.vbs /rilc

  3. Restart the computer.

More information

After you rebuild theTokens.dat file, you must reinstall your product key by using one of the following methods:

  • At the same elevated prompt command, type the following command, and then press Enter:

    cscript.exe %windir%\system32\slmgr.vbs /ipk \<product key>

  • Right-click My Computer, select Properties, and then select Change product key.

Note

  • You should never use the /upk switch to uninstall a product key. To install a product key over an existing product key, use the /ipk switch.
  • For more information about KMS client setup keys, see KMS Client Setup Keys.