Forum Discussion
Windows 10 Subscription Activation via Powershell
Your if statement appears to be missing an evaluation. As you have it originally you have this
if($ProductKey)
So in effect, to quote, "if Product Key what?". What do you want product key to be? I would say you want the script block below to run if the product key is not null/emtpy, correct? So something like this might work
$ProductKey = (Get-CimInstance -ClassName SoftwareLicensingService).OA3xOriginalProductKey
if ($null -ne $ProductKey)
{
start-process c:\Windows\System32\changePK.exe -ArgumentList "/ProductKey $ProductKey"
}
Thanks for the response. I made the change based on your suggestion and what this did was pull up the GUI version of the windows key activation where it asks to manually enter the key. Progress, you could say, but this script needs to be silent and input that information on it's own. This gives me something to work on, but if you have any more suggestions, I would greatly appreciate it.