Get #windows 10 digital license with #Powershell #winserv #OSD #WDS   2 comments

When rebuilding your windows 10 desktop that hold a digital license key there is no piece of paper that tells you the activation key.

with the following command you can read the product key

$service = get-wmiObject -query ‘select * from SoftwareLicensingService’

this is handy for getting the key but when you are deploying a WDS image and everything needs to be unattended you will need a little PowerShell script

As an option there to place a different key for if you are in a mixed environment.

$service = get-wmiObject -query ‘select * from SoftwareLicensingService’

$service = get-wmiObject -query ‘select * from SoftwareLicensingService’
if($key = $service.OA3xOriginalProductKey){
    Write-Host ‘Activating using product Key:’ $service.OA3xOriginalProductKey

    #Write-Host ‘Key not found., use a different license’
       # $service.InstallProductKey(‘Put your License KEY here’)


Save this as a Powershell script and put this in the unattended.xml and when deploying the Windows 10 will be auto activated

Get the script from the site or from the TechNet gallery.


Follow Me on Twitter @ClusterMVP

Follow My blog

Linkedin Profile Http://

Google Me :

Bing Me :


Posted March 19, 2017 by Robert Smit [MVP] in Powershell

Tagged with

2 responses to “Get #windows 10 digital license with #Powershell #winserv #OSD #WDS

Subscribe to comments with RSS.

  1. Pingback: Get Windows 10 digital license with Powershell - How to Code .NET

  2. Pingback: Helpful Windows Admin Tips | Matt Slay, PhC

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter

  • RSS Azure and Microsoft Windows Server Blog

  • <span>%d</span> bloggers like this: