I had to seach web only to find out, there are no comprehensive tools how to update / replace product key for Windows OS activation. Thus i am posting this 3 line code so you can activate your OS. This code can be used for mass deployment as well. This code however assumes, you have your original OEM key in the BIOS. If not, you may still activate W10 by installing WIn 7 first and upgrade afterwards.

I also repackaged the script should you need to use it in SCCM / MDT. When using OEMActivation.exe, you may review the log found in c:\windows\temp\OEMActivation.log

NOTE: I noticed script throwing error in Win 8 / 8.1. However, you may use it to get key from BIOS and copy paste it manually



[string]$lic = wmic path SoftwareLicensingService get OA3xOriginalProductKey 
$OA3 = ($lic.Replace('OA3xOriginalProductKey','')).replace(' ',''Invoke-Expression -Command "Cscript.exe c:\windows\system32\slmgr.vbs /ipk $OA3"