2019-05-17

Windows 10 Install Embedded OEM Product Key

Install and activate embedded Windows 10 OEM product key

Save as .ps1 and run with PowerShell

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
if ($myWindowsPrincipal.IsInRole($adminRole)) {
    # We are running as administrator
    $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
    $Host.UI.RawUI.BackgroundColor = "DarkBlue"
    clear-host
} else {
    # We are not running as administrator
    $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
    $newProcess.Arguments = $myInvocation.MyCommand.Definition;
    $newProcess.Verb = "runas";
    [System.Diagnostics.Process]::Start($newProcess);
    exit
}

echo "Uninstalling the current product key from Windows ..."
cscript /b C:\Windows\System32\slmgr.vbs /upk

echo "Removing the product key from the registry ..."
cscript /b C:\Windows\System32\slmgr.vbs /cpky

$Productkey = (Get-WmiObject -Class SoftwareLicensingService).OA3xOriginalProductkey
echo "Installing OEM key $Productkey ..."
cscript /b C:\Windows\System32\slmgr.vbs -ipk $Productkey

echo "Activating Windows ..."
cscript /b C:\Windows\System32\slmgr.vbs -ato