How to Deploy Windows 10 with a OEM ProductKey from the BIOS with Microsoft Deployment Toolkit

For a customer I had to adjust their Microsoft Deployment toolkit installation to use the OEM Product Key from the BIOS instead of a general Volume Licensing key.

If you want to get the Productkey from the BIOS you can do this with the following Powershell commands:

Software Licensing Service WMI Class information:

Please be aware that by default this class is only available in a Full Windows OS.

Powershell Script:

$Productkey = (Get-WmiObject -Class SoftwareLicensingService).OA3xOriginalProductkey



This will give the 5X5 Productkey as a result.

This can be used with Powershell to input into the Software Licensing Manager tool (SLMGR.vbs) with the /ipk option.

iex "cscript /b C:\Windows\System32\slmgr.vbs -ipk $Productkey"


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

Now you can use this script within MDT as well.


Download the PowerShell script and save it to your %DeploymentShare%\Scripts folder

Add a new 'Run PowerShell Script' step to your Task Sequence and configure it with the settings below:


Happy Deploying,...

Comments (7)

  1. P. says:

    Great, thank you very much. I tried bat/cmd/vbs but had trouble with it. This powershell script worked flawlessly.
    Exactly what i was looking for.

  2. P. says:

    Hello, I have been using this since january. With OEM 8/8.1/10 key. Works great. Now I have implemented Win10-1703 and no go anymore. For as far as I know the invoke expression and the slmgr still work the same. Could you help me with this. Thanks in advance.
    (changed email)

  3. katherine says:

    Where in the task sequence would you put this?

    1. ERadix77 says:

      In the full Windows OS part of the Task Sequence.

      1. albert says:

        i cannot seem to find that task sequences part… do you mean under Install – Install OS? i cannot seem to get this to work. is there anyway of getting it to ignore having to enter a key during install and have the script run once the OS is installed? thanks!

  4. Paras Kumar says:

    Hi. Thanks for the powershell script. It’s working as the windows gets activated with the OEM product key. But at the end of the deployment i do get an error. The ZTIPowershell.log shows the below. How can I resolve this issue ?

    \Microsoft.BDD.TaskSequencePSHost40.exe” “\\WDS\UDSJuly2017$\Scripts\SetOEMProductKey.PS1” “C:\MININT\SMSOSD\OSDLOGS” ZTIPowerShell 4/10/2017 11:04:04 a.m. 0 (0x0000)
    ZTI ERROR – Non-zero return code by ZTIPowerShell, rc = -1073422296 0xC004E028 ZTIPowerShell 4/10/2017 11:04:15 a.m. 0 (0x0000)
    Event 41002 sent: ZTI ERROR – Non-zero return code by ZTIPowerShell, rc = -1073422296 0xC004E028 ZTIPowerShell 4/10/2017 11:04:15 a.m. 0 (0x0000)

Skip to main content