Close Menu
Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Facebook X (Twitter) Instagram
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    • Home
    • Intune
    • Windows
      • Modern Workplace
    • macOS
    • Android
    • iOS
    • Automation
      • Logic Apps
      • Intune Monitoring
      • GitHub
    • Security
      • Passwordless
      • Security
    • Speaking
    • About me
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Home»Intune»Activate Windows with the firmware embedded product key
    Intune

    Activate Windows with the firmware embedded product key

    Peter KlapwijkBy Peter KlapwijkJune 25, 2022Updated:June 26, 202214 Mins Read

    Windows devices that are Active Directory joined (or Hybrid Azure Active Directory joined), might be activated by using an on-premises KMS server, which has been (and still is) perfectly fine. But when you migrate these devices to Azure AD only joined devices, these devices might not have direct access to the on-premises environment anymore.

    You could end up with devices, which still try to activate Windows after a factory reset by reaching out to a KMS server that is not reachable. An option is to activate Windows with the firmware embedded product key, which is available on most (business) laptops.

    If you’re using a subscription activation Windows license (Windows E3/ E5 license), subscription activation should automatically pull the firmware embedded activation key and activate the underlying pro license. But this only happens automatically during the Out of the Box Experience.

    The solution

    With a small PowerShell script, we can easily query the device for its ‘baked-in’ product key and use that key to active Windows, so the device doesn’t have to reach out to a KMS server anymore for activation.

    I’ve created the below script to get the job done. As I wanted to deploy the script as a win32 app with Microsoft Intune, I also created a small detection script.

    With this command, we can retrieve information regarding the Windows license, including the Original Product Key:

    Get-CimInstance -query 'select * from SoftwareLicensingService'

    slmgr.vbs is used to install and activate the key.

    I’ll use the below command to check if the ProductKeyChannel is changed to OEM:DM, in the detection script, but also to write it to the transcript.

    Get-WmiObject SoftwareLicensingProduct -Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f' and LicenseStatus = '1'"

    This is the complete activation script:

    # --------------------------------------------------------------------------------------------- # 
    # Author(s)    : Peter Klapwijk - www.InTheCloud247.com      					                #
    # Version      : 1.0                                                                            #
    #                                                                                               #
    # Description  : Script retrieves the firmware-embedded product key and activates Windows       #
    #                with this key														            #
    #                														                        #
    # Changes      : v1.0 Initial version	                                                        #
    #                														                        #
    # --------------------------------------------------------------------------------------------- #
    
    # Start Transcript
    $Transcript = "C:\programdata\Microsoft\IntuneManagementExtension\Logs$($(Split-Path $PSCommandPath -Leaf).ToLower().Replace(".ps1",".log"))"
    Start-Transcript -Path $Transcript | Out-Null
    
    #Get firmware-embedded product key
    try {
        $EmbeddedKey=(Get-CimInstance -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
        write-host "Firmware-embedded product key is "$EmbeddedKey""
    } catch {
        write-host "ERROR: Failed to retrieve firmware-embedded product key"
        Exit 1
    }
    
    #Install embedded key
    try {
        cscript.exe "$env:SystemRoot\System32\slmgr.vbs" /ipk "$EmbeddedKey"
        write-host "Installed license key"
    } catch {
        write-host "ERROR: Changing license key failed"
        Exit 2
    }
    
    #Active embedded key
    try {
        cscript.exe "$env:SystemRoot\System32\slmgr.vbs" /ato
        write-host "Windows activated"
    } catch {
        write-host "ERROR: Windows could not be activated."
        Exit 3
    }
    
    #Check Product Key Channel
    $getreg=Get-WmiObject SoftwareLicensingProduct -Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f' and LicenseStatus = '1'"
    $ProductKeyChannel=$getreg.ProductKeyChannel
    
        if ($getreg.ProductKeyChannel -eq "OEM:DM") {
            write-host "Windows activated, ProductKeyChannel = "$ProductKeyChannel""
    		Exit 0
        } else {
    		write-host "ERROR: Windows could not be activated. "$ProductKeyChannel""
    		Exit 4
        }
    
    Stop-Transcript

    The detection script checks if the embedded key is used (OEM:DM) or a retail key is used, which in my case is also fine.

    That is done by the same command as used in the activate script to check the ProductKeyChannel.

    The detection script:

    # --------------------------------------------------------------------------------------------- # 
    # Author(s)    : Peter Klapwijk - www.InTheCloud247.com      					                #
    # Version      : 1.0                                                                            #
    #                                                                                               #
    # Description  : Detection script to be used with Microsoft Intune, determines if the current   #
    #                Product Key Channel is OEM or Retail								            #
    #                														                        #
    # Changes      : v1.0 Initial version	                                                        #
    #                														                        #
    # --------------------------------------------------------------------------------------------- #
    
    $getreg=Get-WmiObject SoftwareLicensingProduct -Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f' and LicenseStatus = '1'"
    $ProductKeyChannel=$getreg.ProductKeyChannel
    
        if ($getreg.ProductKeyChannel -eq "OEM:DM" -or $getreg.ProductKeyChannel -eq "Retail") {
            write-host "Correct ProductKeyChannel found = "$ProductKeyChannel""
    		Exit 0
        } else {
    		write-host "ERROR: Wrong ProductKeyChannel found =  "$ProductKeyChannel""
    		Exit 4
        }

    The most recent version of the script is also found on my GitHub.

    The script is provided as-is. I’m not a scripting guru, so make your changes if needed.

    Intune Microsoft Endpoint Manager PowerShell Windows Windows 10 Windows 11
    Share. Facebook Twitter LinkedIn Email WhatsApp
    Peter Klapwijk
    • Website
    • X (Twitter)
    • LinkedIn

    Peter is a Security (Intune) MVP since 2020 and is working as Modern Workplace Engineer at Wortell in The Netherlands. He has more than 15 years of experience in IT, with a strong focus on Microsoft technologies like Microsoft Intune, Windows, and (low-code) automation.

    Related Posts

    Create a Windows Driver update approval report with Logic Apps

    July 18, 2023

    Configure Windows Update for Business reporting

    June 8, 2023

    Configure the Windows 11 start menu with Microsoft Intune

    October 7, 2021
    View 1 Comment

    1 Comment

    1. Ramon on August 4, 2022 09:24

      Peter, bedankt.

      Reply
    Leave A Reply Cancel Reply

    Peter Klapwijk

    Hi! Welcome to my blog post.
    I hope you enjoy reading my articles.

    Hit the About Me button to get in contact with me or leave a comment.

    Awards
    Sponsor
    Latest Posts

    Hard drive and partitions are not shown while installing Windows

    October 14, 2025

    Intune compliance for Windows 365 Cloud PCs

    September 12, 2025

    Intune connector for Active Directory configuration error

    August 29, 2025

    Deploy Microsoft Defender updates in deployment rings

    July 4, 2025
    follow me
    • Twitter 4.8K
    • LinkedIn 6.1K
    • YouTube
    • Bluesky 1.5K
    Tags
    Administrative Templates Android Automation Autopilot Azure Azure AD Browser Conditional Access Edge EMS Exchange Online Feitian FIDO2 Flow Google Chrome Graph Graph API Identity Management Intune Intune Monitoring iOS KIOSK Logic Apps macOS MEM MEMMonitoring Microsoft 365 Microsoft Defender Microsoft Edge Microsoft Endpoint Manager Modern Workplace Office 365 OneDrive for Business Outlook Passwordless PowerApps Power Automate Security SharePoint Online Windows Windows 10 Windows10 Windows 11 Windows Autopilot Windows Update
    Awards
    Sponsor
    Follow me on Twitter
    Tweets by inthecloud_247
    Tags
    Administrative Templates Android Automation Autopilot Azure Azure AD Browser Conditional Access Edge EMS Exchange Online Feitian FIDO2 Flow Google Chrome Graph Graph API Identity Management Intune Intune Monitoring iOS KIOSK Logic Apps macOS MEM MEMMonitoring Microsoft 365 Microsoft Defender Microsoft Edge Microsoft Endpoint Manager Modern Workplace Office 365 OneDrive for Business Outlook Passwordless PowerApps Power Automate Security SharePoint Online Windows Windows 10 Windows10 Windows 11 Windows Autopilot Windows Update
    Archives
    Peter Klapwijk

    Hi! Welcome to my blog post.
    I hope you enjoy reading my articles.

    Hit the About Me button to get in contact with me or leave a comment.

    Copy right

    This information is provided “AS IS” with no warranties, confers no rights and is not supported by the authors, or In The Cloud 24-7.

     

    Copyright © 2025 by In The Cloud 24-7/ Peter Klapwijk. All rights reserved, No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

    Shorthand; Don’t pass off my work as yours, it’s not nice.

    Recent Comments
    • Luis on Application installation issues; Download pending
    • AndrewWak on Issues syncing SharePoint Online libraries with OneDrive for Mac
    • Peter Klapwijk on Deploy Microsoft Defender updates in deployment rings
    • Magnus on Deploy Microsoft Defender updates in deployment rings
    • Gertjan Jongeneel on Add an Azure AD group to the local administrators group with Microsoft Intune
    most popular

    Application installation issues; Download pending

    October 1, 2024

    How to change the Windows 11 language with Intune

    November 11, 2022

    Restrict which users can logon into a Windows 10 device with Microsoft Intune

    April 11, 2020

    How I solved a strange Kerberos issue

    December 12, 2024
    Recent Comments
    • Luis on Application installation issues; Download pending
    • AndrewWak on Issues syncing SharePoint Online libraries with OneDrive for Mac
    • Peter Klapwijk on Deploy Microsoft Defender updates in deployment rings
    • Magnus on Deploy Microsoft Defender updates in deployment rings
    • Gertjan Jongeneel on Add an Azure AD group to the local administrators group with Microsoft Intune
    Copy right

    This information is provided “AS IS” with no warranties, confers no rights and is not supported by the authors, or In The Cloud 24-7.

    Copyright © 2023 by In The Cloud 24-7/ Peter Klapwijk. All rights reserved. No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

    Shorthand: Don’t pass off my work as yours, it’s not nice.

    Peter Klapwijk – In The Cloud 24-7
    X (Twitter) LinkedIn YouTube RSS Bluesky
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.

    Manage Cookie Consent
    To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
    View preferences
    {title} {title} {title}