Powershell: Upgrade Windows Pro to Enterprise

Home / Powershell: Upgrade Windows Pro to Enterprise

Learn how to upgrade your Windows edition with Powershell

If you are running on OEM licenses and finally getting a volume license or you need to change the Windows edition of your clients, you can do this with just a few Powershell commands.

All commands have to be executed on the client. Either use the Invoke-Command cmdlet or start a remote Powershell session. In this example we use a remote session:

Enter-PSSession -ComputerName yourclient

First of all, you can check which edition is active on the client:

Get-WindowsEdition -Online

The -online parameters let the cmdlet check for the active installation instead of an image.
The output looks like:

Powershell Current Windows Edition

Check the currently installed Windows edition

This client is running a professional edition of Windows.

To change the edition of Windows, you have to provide a new key for Windows. Either use your MAK key or one of the KMS client setup keys (if you want Windows to use your KMS).

These 2 commands will a) Connect to the software licensing service and b)change the key of the installed products to your product key:

$sls = Get-WmiObject -Query 'SELECT * FROM SoftwareLicensingService' 
@($sls).foreach({
    $_.InstallProductKey('Windows-ProductKey')
    $_.RefreshLicenseStatus()
})
Powershell: Upgrade Windows edition

Upgrade your Windows edition

To verify if the upgrade worked correctly, use the Get-WindowsEdition cmdlet again.

Powershell: Upgraded Windows Edition

Your edition has been upgraded

That’s all you need to do.

You can enhance the commands to upgrade many clients in batch processing or combine them to a script checking for the version and run only if required. Let me know in the comments what your script looks like.

2 thoughts on “Powershell: Upgrade Windows Pro to Enterprise”

  1. Hi Andy,
    Thank you so much for this post. I am working on upgrading all Win10 Pro machines in our company to Enterprise.

    The script above:
    $sls = Get-WmiObject -Query ‘SELECT * FROM SoftwareLicensingService’
    @($sls).foreach({
    $_.InstallProductKey(‘Windows-ProductKey’)
    $_.RefreshLicenseStatus()
    })

    Runs when computers are online. It gives error when it can’t connect to a machine. How can I write the error output to a csv so I can see which machines are not successfully upgraded? I am learning Powershell as I go. Thank you for input.

  2. If you put the command inside a Try Catch the Try portion will attempt to run, and the Catch will be what happens in the event of a failure, you can have it append the PC name to a file to get a list of systems that worked or didn’t work. Something like
    @($sls).foreach({
    TRY {
    $_.InstallProductKey(‘Windows-ProductKey’)
    $_.RefreshLicenseStatus()
    }
    CATCH {

    Add-Content “PATH\TO\Log.txt” “$_,Failed”
    })

Leave a Reply

Your email address will not be published. Required fields are marked *