How to Change the Windows Server Activation Mechanism

The situation that prompted this article involved a Windows Server Standard Edition virtual machine that was migrated from a Windows Server Datacenter host to a Windows Server Standard Edition host. On the source host, the guest had used Automatic Virtual Machine Activation. That feature only exists on Datacenter Edition, so the virtual machine immediately went into an unactivated state. I switched it to Volume Licensing. However, the method that I used works to change the Windows Server activation mechanism from any mode to any other eligible mode.

[citationic]

What You Need to Change the Windows Server Activation Mechanism

To switch to another Windows Server activation mechanism, you need to have an appropriate license key for that mechanism. This applies to anything except temporarily switching to grace period coverage.

  • Automatic Virtual Machine Activation (AVMA): A Windows Server instance running as a virtualized guest on a host running the same or later version of Windows Server Datacenter Edition needs the corresponding publicly available Automatic Virtual Machine Activation key. Notice three points: Windows Server as a guest (any edition), Windows Server Datacenter Edition as the host, and the host must run a version of Windows Server equivalent to or later than the guest. The linked page on Microsoft Learn has a chart that lays this out visually. The host must have a separate, valid, and activated license key. It cannot use one of the public AVMA keys.
  • Multiple Activation Key (MAK) Volume Licensing: If your organization has a volume license agreement, then your reseller or Microsoft has provided you with a link to access your licensing portal online. After signing in, you will find your license keys. Listed among them, you will find MAKs for the versions of Windows Server that you have paid for. MAKs have an activation ceiling, listed with the key along with the number of remaining activations. Note that Microsoft allows some grace for moving keys among hosts and for situations such as a virtualized instance of Windows Server covered by the host’s virtualization rights without using AVMA. Therefore, the total number of activations will exceed the number that you purchased. Do not treat these extra activations as free licenses. You have no entitlement to use more instances than your paid license allows. Keep this in mind if you also have KMS on-premises. To switch to MAK activation, locate the applicable MAK and have it ready.
  • Key Management Services (KMS) Licensing: To make internal (and external) auditing simpler, you can use KMS. This requires a single host in your organization to have an installed Windows Server KMS key that covers the edition of Windows Server on the system that you want to activate. This article does not cover setting up the KMS host. You can get started on Microsoft Learn. Note that KMS works for more products than just Windows Server. As the person trying to activate Windows Server on a KMS client host, you do not need to have access to your organization’s licensing portal, nor do you need to know any of the keys owned by your organization. KMS and MAK activations cumulatively count against the number of instances your license allows you to operate, even if the technology does not prevent you from activating more. Before configuring a KMS client, check with the person in your organization responsible for licensing to ensure that you have available legal instances or that you have coverage by a negotiated true-up plan. Once you have done your due diligence, you only need the publicly available generic volume license key that applies to the operating system that you need to activate. To activate, the host will need connectivity to the KMS host over TCP port 1688.
  • Retail Licensing: You only need the applicable retail key.
  • Evaluation Grace Period: You can revert to a state that behaves like the grace period state of an evaluation edition. Remember that it counts down, and once that grace period expires, the operating system will lose some functionality and reboot every hour. You do not need a key for this mode.
  • OEM: OEMs have some ability to modify the Windows Server activation behavior. Removing a product key on a server installed from OEM media may not behave as expected. Otherwise, it acts like retail.

Once you have settled on a method, verified the legal status of your licensing situation, and have a key prepared, you can get started.

Note: You could use the activation panes in Windows Server’s Settings GUI. I will not show that because you can easily find it, and then it’s just a matter of filling in the blanks. However, that only exists on Windows Server with the Desktop Experience. Also, the license activation portion of Settings glitches sometimes and will not allow you to submit a new key. The technique shown in this article always works.

Step 0: Get to the Command Line

All these steps occur at an elevated command prompt (cmd). Alternatively, you can use an elevated PowerShell prompt (powershell). We will work with the “slmgr.vbs” script, which Microsoft builds into every distribution of Windows Server to manage licensing and activation.

At any point, you can run slmgr /dli or slmgr /dlv to view your server’s current licensing status. The dli switch shows simple information, which will usually suffice. The dlv switch retrieves much more. These commands will tell you if the server has activated, the number of days remaining in a grace period, and more. With the dialog box visible and focused, you can press CTRL+C to place its contents on the clipboard.

Step 1: Remove and Clear the Existing Product Key

Unless you intend to go back to a grace period, you do not technically need to clear the existing key. I always follow this step because it takes little effort and ensures a clean transition.

First, run the following command:

slmgr /upk

The UPK switch tells slmgr to uninstall any product key. You should first receive a message that it uninstalled the product key. Next, the tool will prompt for a reboot. I recommend that you reboot before proceeding. You can use shutdown /r /t 0 from the command line to reboot immediately.

Dialog box shown by SLMGR asking for a reboot after uninstalling a Windows Server product key.
SLMGR Reboot Prompt

After the reboot, expect to see the overlay asking you to activate Windows. If you do not see this, then use the status command from step 0 to see the current state before doing anything else.

Semi-transparent overlay shown on the desktop by Windows when it has not been properly activated
Windows Activation Overlay

Next, run:

slmgr /cpky

The CPKY switch instructs slmgr to remove surface traces of product keys.

At this point, your server has reverted to its evaluation grace period. If you do not yet have a key to replace the one that you removed, then you can continue like this until the grace period expires. See Step 0 for instructions to view activation status.

Optional Rearm

If you wind up with no grace period, you can “rearm” the activation system.

slmgr /rearm

You can run this a finite number of times to extend the grace period.

Step 2: Enter the New Key

Now it’s time to tell Windows Server about that key you gathered. The following shows the key that I entered to convert my Windows Server 2022 installation to a Standard Edition KMS client:

slmgr /ipk VDYBN-27WPP-V4HQT-9VMD4-VMK7H

If you have proper network connectivity to activate the key that you created, then you could simply wait and the licensing service will eventually reach out to the activation server (or the host, if you used an AVMA key). For the one that I used to work, the system would need to belong to a domain that had the KMS server’s DNS entries in Active Directory. Most of the other key types require the ability to connect to Microsoft’s public licensing servers. OEM keys may activate immediately.

You don’t have to wait. The next section shows how to contact an activation server immediately.

Step 3: Activate Windows Server

The activation command depends on the chosen activation method.

Automatic Online Activation

Windows Server can activate most key types with minimal input, provided that it has enough information to reach the target activation server. AVMA guests will use a local service to talk to the host through SMBus, so they don’t need anything else. Retail and MAK will try to connect to the public Microsoft servers, so your host only needs Internet access. It performs this connection over the standard HTTP and HTTPS ports of 80 and 443, respectively. If your host belongs to an Active Directory domain and the domain’s DNS contains records for a KMS server, then the host will automatically attempt to activate over port 1688. While not covered in this article, you can also use the Volume Activation Management Tool to configure internal proxies for activation.

To activate Windows Server online without waiting for the automatic process, simply enter the following command:

slmgr /ato

After a moment, you will receive a pop-up box that indicates success or failure.

Manually Specify a KMS Host

If the KMS client that you want to activate does not belong to a domain or the directory does not publish KMS information in DNS, then you can tell slmgr how to reach a KMS server. First, you must have entered the appropriate GVLK in step 2. The host to activate must have TCP/IP connectivity to the KMS server over port 1688 (overridable).

Type the following to activate with a specific KMS host:

slmgr /skms KMSSRV

In the above, “KMSSRV” refers to the name of the KMS server. For that to work, the Windows Server installation to activate must know how to resolve that name to the correct IP. You can use DNS or an override in the HOSTS file. Alternatively, you can specify an IP address in place of the host name. However, that only works for IPv4 addresses. The colons in an IPv6 address will confuse slmgr.

If you need to override the port, do so by typing a colon at the end of the host name followed by the port number: slmgr /skms KMSSRV:22700.

You can also activate KMS offline by typing an activation ID after the host and port. The next section covers offline activation.

Offline Activation

You can use the licensing tool for offline activation. This multi-step process requires some back and forth between the host to activate and Microsoft’s activation system. It will not work with generic keys (KMS or AVMA clients). I have seen claims of tools that exist for offline KMS clients, but I do not know of any official support, so beware. The architecture of KMS server allows you to activate its KMS key(s) offline, but the KMS clients need to talk to it. AVMA clients use SMBus and do not need network connectivity. If you have entered KMS/AVMA keys and they don’t work, start over with step 1.

To start the offline activation process, run:

slmgr /dti

This will show a dialog with an Installation ID:

Dialog box of Installation ID provided by slmgr

You’ll need to call Microsoft and provide the displayed Installation ID to get an activation code. If you’re using a MAK or you are installing a KMS key on the KMS server, Microsoft publishes a page with the relevant licensing phone numbers. Alternative ways to get an activation code appear in the next sub-section.

Once you have the activation code, enter it like so:

slmgr /atp ACTIVATIONCODE

The next section shows how to get a key if you need a different phone number.

Alternative Licensing Phone Numbers for Offline Activation

Microsoft does not provide a site with a list of numbers for OEM or retail product keys. You can also use this instead of online activation for a MAK. For this procedure, you’ll need to use a system with the desktop experience. In my case, a Windows 11 system showed the same phone number as a Windows Server 2022 installation.

On a system running the desktop experience, run:

slui 4

That will present a window that asks for your region. Select yours and click Next:

Windows displayed by Windows licensing interface for region selection

You will now see a screen that shows the phone number to dial. When you call the number, it will prompt you for the Installation ID. If you ran the graphical interface on a system other than the one to activate, provide the Installation ID from slmgr on that system as shown in the previous section and click Cancel here. Otherwise, you can continue through this wizard by clicking Enter Confirmation ID.

Enter the number provided by the phone system and click Activate Windows.

Monitor Your License Status

Windows Server must verify its activation status every 180 days. If it cannot reach an online public or KMS host, then it switches to reduced-functionality mode and reboots every hour. Servers that can reach the Internet or an internal KMS host should not have problems. AVMA guests on Windows Server Datacenter Edition hosts of the same or a later version should not have trouble, either. If you have a KMS server, check on it routinely, as a KMS host failure will cascade licensing problems throughout your organization. Remember the /dli and /dlv switches from step 0 to check licensing status.

More Fun with SLMGR

This article only showed the most common uses for the SLMGR tool. If you have more complicated needs, such as token-based activation or disjointed domains that you want to auto-discover KMS, Microsoft Learn has a detailed slmgr page.