The following script will read the UEFI stored Windows licensing key and show it – it then will attempt to activate Windows and probably even e.g. your Microsoft Office installation – this is not necessarily intentional by the script, rather then a coincidence that I discovered by using this script to activate Windows after it was automatically deployed from an image that had a pre-injected volume license key. Office likely got activated along with Windows.
In any case – it helps you to activate Windows or simply read out your license key.
1 2 3 4 5 6 7 | $service = get-wmiObject -query 'select * from SoftwareLicensingService' if($key = $service.OA3xOriginalProductKey){ Write-Host 'Product Key:' $service.OA3xOriginalProductKey $service.InstallProductKey($key) }else{ Write-Host 'Key not found.' } |