How-to: Retrieve the Windows Product Key

The Windows product key is a 25-character code used to activate Windows.

Get-CimInstance -ClassName SoftwareLicensingService | Select-Object -ExpandProperty OA3xOriginalProductKey

This can also run against remote machines by adding the -ComputerName option. In most cases, Windows 10 activates automatically using a digital license and doesn’t require you to enter a product key. If no product activation key has been entered then nothing will be returned by the CIM command above.


“I can always guess how many jelly beans are in a jelly bean jar, even if I’m wrong” ~ Anchorman.

Related PowerShell Cmdlets

DISM /Set-ProductKey - Set the product key of an offline image.
Get-CimInstance - Get a managed resource (storage, network, software etc).
SLMGR - Software Licensing Management Tool Activate Windows license and product key.

Copyright © 1999-2024
Some rights reserved