Windows

Windows 2019 – Windows License Expired

Windows Server 2019 is out now for a couple of months now, and some of you may be interested in playing with it. When you first install it, you can test it for 180 days (so-called Grace Period) after which you need to activate it with a proper production license.

When installed Windows 2019 gives you 180 days to use. After that time in the right bottom corner, you will be greeted with message Windows License is expired and your Windows Server machine will start shutting down. You can start it up again, but after a while, another shutdown will occur. Normally before the trial license expires you should activate it with a proper license. But there are many reasons why you may want to run Trial version for a little longer. Fortunately, there are a couple of steps that we can do to make it work for a longer period of time. Microsoft allows you to extend that trial period six times. Of course, this is only permitted in testing environments, and not in production for which you require a proper license key.

How to extend Windows Server 2019 Evaluation

First we need to check current license status. We can do this using slmgr command with DLV switch.

slmgr -dlv

As you can see above the license was already activated one time since the counter of remaining Windows rearm is showing five more activations. Now we need to run slmgr with rearm switch in PowerShell or CommandLine Window and finally make a reboot for the Windows license to activate. Remember that it has to run as Administrator.

slmgr -rearm

After reboot message from bottom right corner should be no more and license extended. We just need to quickly verify this with slmgr using DLI switch.

As you can see license is now activated for 180 days, err 10 days. In normal circumstances, you would just have another 180 days period and you could extend this 5 more times, which is quite a long time. Something that only testing environment or a lab usage might explain. In my case, however, I was greeted with just 10 days. It also says Initial grace period. Not what I expected, and it makes sense why the remaining count was showing five activations left because I've already activated it once thinking that I'm good for 180 days! We can also verify this on the Activation window but that doesn't give us details. It says it's activated but at the same time only for 10 days.

Changing initial grace period into full grace period

My first thought was that I need to activate it online using ATO switch.

Unfortunately, that gives you an error and tells you to contact Microsoft. Not really helpful error message if you ask me. I'm now checking to make sure my Windows 2019 image is actually Evaluation version. You can do that with DISM command.

dism /online /Get-CurrentEdition

If you're wondering what ONLINE stands for, it's actually current Windows you're logged into. DISM is a primary tool to work with images, therefore, most commands don't require an ONLINE switch. But in our case, we need it to work with our current running Windows.

As I wasn't the person that downloaded this Windows Server 2019 I decided to download a newly rereleased evaluation version of Windows Server 2019 Evaluation that's available on Microsoft website. An hour later, a new virtual machine is set up and everything seems different.

Newly downloaded Windows Server 2019 is already valid for 180 days. I don't have to do the above steps (which will be still useful for you if you will want to rearm your testing environment again and again) to rearm my license so it's definitely something else in my case then new standard approach to activating Windows. I've decided to try and export license key from the newly installed Windows and use it to activate the old, broken one.

With no luck, at all.

I've even tried to activate it command line style naively expecting different results

C:\Windows\system32>dism /online /Set-Edition:ServerStandardEval /AcceptEula /ProductKey:J4WNC-H9BG3-6XRX4-3XD8K-Y7XRX

Deployment Image Servicing and Management tool
Version: 10.0.17763.1

Image Version: 10.0.17763.253

Starting to update components...
Starting to install product key...
Finished installing product key.

Starting to apply edition-specific settings...

Error: 1168

An error occurred while applying target edition component settings. The upgrade cannot proceed.
For more information, review the log file.

The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

I did fail to activate this instance and decided to start from scratch. Hope you do learn on my mistakes and have better luck then I do.

Steps that can potentially work for you - Sent by Wilko
  • Install Windows Server 2019 Public Key using (DISM /Online /Set-Edition:ServerStandard /ProductKey:N69G4-B89J2-4G8F4-WWYCC-J464C /AcceptEula)
  •  Then change that Public Windows Server 2019 Key to a Retail 2019 Server key MAK key that you've purchased
Steps that can potentially work for you - Send by Paul Boyce

While for me below steps didn't work, maybe in your case those will help out (thanks Paul Boyce).

  • Click Start and type CMD in the Start Search menu
  • Right Click and choose Run as administrator
  • To remove any existing product key (in case you used a trial key), enter and run the command slmgr.vbs /upk
  • Clear the product key from the registry by running slmgr.vbs /cpky
  • To enter your new product key, use the command: slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx where the x is your actual product key
  • Lastly, activate Windows by entering the command slmgr.vbs /ato
  • Windows is now activated.
slmgr.vbs command line arguments

Below you can find an explanation for each and every switch slmgr.vbs offers to you.

Windows Software Licensing Management Tool
Usage: slmgr.vbs [MachineName [User Password]] [<Option>]
           MachineName: Name of remote machine (default is local machine)
           User:        Account with required privilege on remote machine
           Password:    password for the previous account

Global Options:
/ipk <Product Key>
    Install product key (replaces existing key)
/ato [Activation ID]
    Activate Windows
/dli [Activation ID | All]
    Display license information (default: current license)
/dlv [Activation ID | All]
    Display detailed license information (default: current license)
/xpr [Activation ID]
    Expiration date for current license state

Advanced Options:
/cpky
    Clear product key from the registry (prevents disclosure attacks)
/ilc <License file>
    Install license
/rilc
    Re-install system license files
/rearm
    Reset the licensing status of the machine
/rearm-app <Application ID>
    Reset the licensing status of the given app
/rearm-sku <Activation ID>
    Reset the licensing status of the given sku
/upk [Activation ID]
    Uninstall product key

/dti [Activation ID]
    Display Installation ID for offline activation
/atp <Confirmation ID> [Activation ID]
    Activate product with user-provided Confirmation ID

Volume Licensing: Key Management Service (KMS) Client Options:
/skms <Name[:Port] | : port> [Activation ID]
    Set the name and/or the port for the KMS computer this machine will use. IPv6 address must be specified in the format [hostname]:port
/ckms [Activation ID]
    Clear name of KMS computer used (sets the port to the default)
/skms-domain <FQDN> [Activation ID]
    Set the specific DNS domain in which all KMS SRV records can be found. This setting has no effect if the specific single KMS host is set via /skms option.
/ckms-domain [Activation ID]
    Clear the specific DNS domain in which all KMS SRV records can be found. The specific KMS host will be used if set via /skms. Otherwise default KMS auto-discovery will be used.
/skhc
    Enable KMS host caching
/ckhc
    Disable KMS host caching

Volume Licensing: Token-based Activation Options:
/lil
    List installed Token-based Activation Issuance Licenses
/ril <ILID> <ILvID>
    Remove installed Token-based Activation Issuance License
/ltc
    List Token-based Activation Certificates
/fta <Certificate Thumbprint> [<PIN>]
    Force Token-based Activation

Volume Licensing: Key Management Service (KMS) Options:
/sprt <Port>
    Set TCP port KMS will use to communicate with clients
/sai <Activation Interval>
    Set interval (minutes) for unactivated clients to attempt KMS connection. The activation interval must be between 15 minutes (min) and 30 days (max) although the default (2 hours) is recommended.
/sri <Renewal Interval>
    Set renewal interval (minutes) for activated clients to attempt KMS connection. The renewal interval must be between 15 minutes (min) and 30 days (max) although the default (7 days) is recommended.
/sdns
    Enable DNS publishing by KMS (default)
/cdns
    Disable DNS publishing by KMS
/spri
    Set KMS priority to normal (default)
/cpri
    Set KMS priority to low
/act-type [Activation-Type] [Activation ID]
    Set activation type to 1 (for AD) or 2 (for KMS) or 3 (for Token) or 0 (for all).

Volume Licensing: Active Directory (AD) Activation Options:
/ad-activation-online <Product Key> [Activation Object name]
    Activate AD (Active Directory) forest with user-provided product key
/ad-activation-get-iid <Product Key>
    Display Installation ID for AD (Active Directory) forest
/ad-activation-apply-cid <Product Key> <Confirmation ID> [Activation Object name]
    Activate AD (Active Directory) forest with user-provided product key and Confirmation ID
/ao-list
    Display Activation Objects in AD (Active Directory)
/del-ao <Activation Object DN | Activation Object RDN>
    Delete Activation Objects in AD (Active Directory) for user-provided Activation Object

This post was last modified on October 19, 2019 18:43

Przemyslaw Klys

System Architect with over 14 years of experience in the IT field. Skilled, among others, in Active Directory, Microsoft Exchange and Office 365. Profoundly interested in PowerShell. Software geek.

Share
Published by
Przemyslaw Klys

Recent Posts

Active Directory Replication Summary to your Email or Microsoft Teams

Active Directory replication is a critical process that ensures the consistent and up-to-date state of…

1 week ago

Syncing Global Address List (GAL) to personal contacts and between Office 365 tenants with PowerShell

Hey there! Today, I wanted to introduce you to one of the small but excellent…

5 months ago

Active Directory Health Check using Microsoft Entra Connect Health Service

Active Directory (AD) is crucial in managing identities and resources within an organization. Ensuring its…

7 months ago

Seamless HTML Report Creation: Harness the Power of Markdown with PSWriteHTML PowerShell Module

In today's digital age, the ability to create compelling and informative HTML reports and documents…

8 months ago

How to Efficiently Remove Comments from Your PowerShell Script

As part of my daily development, I create lots of code that I subsequently comment…

8 months ago

Unlocking PowerShell Magic: Different Approach to Creating ‘Empty’ PSCustomObjects

Today I saw an article from Christian Ritter, "PowerShell: Creating an "empty" PSCustomObject" on X…

9 months ago