Security tip: Protect your Windows product key from being stolen

Did you know that when Windows is installed, it continues to store your product key in the registry. This may be useful, if you don't remember which key you used on your current installation. Also if you lost your product key, this can be useful for recovering your product key with some third party tool or with a simple PowerShell script.

But at the same time, your Windows product key is at risk of being stolen. If you are concerned about your product key being stolen (i.e. with some malicious software), you might want to remove it from the registry permanently. This operation is safe and will not affect your OS activation status. Follow this simple tutorial to learn how you can erase the stored product key in Windows 8, Windows 8.1, Windows 7 and Windows Vista.


  1. Open an elevated command prompt. On Windows 7/Vista, type cmd.exe into the Start Menu's search box. The cmd.exe item will appear in the search results. Press Ctrl+Shift+Enter to open the command prompt as administrator. Or another way is to right click it and choosing 'Run as administrator'. On Windows 8/8.1, type cmd.exe right on the Start Screen or press Win+Q and type 'cmd'. When cmd.exe appears in the search results, press Ctrl+Shift+Enter.
  2. In the elevated command prompt you just opened, type the following:
    slmgr /cpky

    Clear product key

That's it!

Here is some explanation for those who want to understand what exactly happens. slmgr stands for Software Licensing Manager, it's a Visual Basic script in your Windows\System32 folder to manage licensing related operations. The /cpky switch tells slmgr to clear the product key.

Bonus tip: Even if the product key is cleared, you can still view the partial product key should you ever need to know which key a particular Windows installation uses. To view the partial product key, at an elevated command prompt, type:

slmgr /dli

Look how it displays the partial product key. If you have a bunch of Windows licenses, this information is enough to identify which product key was used for this installation.

Note that if you installed a volume license edition of Windows, only the partial product key may be viewable by using slmgr /dli. slmgr /cpky is not required.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!


Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

One thought on “Security tip: Protect your Windows product key from being stolen”

Leave a Reply

Your email address will not be published.

Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.