Recently I began preparing a Task Sequence in Microsoft System Center Configuration Manager (SCCM) to upgrade workstations from Windows 8.1 Pro to Windows 10.
A goal of mine was to conserve the product keys we had purchased so they wouldn’t go to waste.
Here is a short Powershell script that could be included as a step in a Task Sequence to accomplish this goal.
$temp = cscript.exe C:\windows\system32\slmgr /dlv #$temp = Select-String -Path .\license.txt -Pattern "Application ID:" #$temp = Select-String -InputObject $temp -Pattern "Application ID:" $temp=Select-String -InputObject $temp -Pattern "Application ID:" $temp=$temp.ToString() $temp=$temp.SubString(57) echo $temp slmgr /upk $temp