Retreive & install oem bios Windows License key

Having trouble with your Windows activation on an OEM device?
You might be able to fix it by retrieving the key from the bios.

Run this in Powershell (Elevation should not be needed)

(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey

If your device came with a license this command will show the key (looks like this: XXXXX-XXXX-XXXXX-XXXXX-XXXXX)

Next you’ll want to check if Windows was installed with your key:

slmgr.vbs /dlv

This will after a few seconds return a pop-up window like this:

screenshot of license details resulting from slmger.vbs /dlv

If the Partial Product Key is not the same as the last 5 digits of the key we retrieved in the 1st step, your operating system is not using the original device license key.

This can be fixed in multiple ways, command-line or via the gui, the 2nd one works in more cases (not all key changes are supported through cli).

Type changepk in the terminal you already have open, it will open up settings at System > Activation

The Gui Option:

Select the change button & copy in the key we retrieved earlier.

Enter your Product Key
Select Activate
All Done, select close

The Command Line Option

The steps above rolled into a script look like this:

Retrieve & install bios key script: (run in elevated PowerShell prompt)

$Key = (wmic path softwarelicensingservice get OA3xOriginalProductKey)
$ProductKey = ($Key[2])
if (!$ProductKey) {
Write-Host "No key present"
} else {
Write-Host "Installing $ProductKey"
& changepk.exe /ProductKey $ProductKey
}
slmgr.vbs /dlv
Write-Host "If Partial Product Key (last 5 digits) is not the same as above, run changepk.exe, click change to manually input the key above"

The reason the script does not always work is not all upgrade paths or key changes are supported in the same way more info on this can be found here: MS Learn website – edition upgrades

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.