WindowsMay 28, 2026 18 views

Activate a Windows Server license on a VPS: complete guide (2019, 2022, 2025)

Activate a Windows Server license on a VPS: complete guide (2019, 2022, 2025)

You just ordered a Windows Server VPS, you connect via RDP... and a warning message informs you that your version expires in X days. Or worse: your server restarts every hour because the evaluation period has expired.

This guide explains how to activate Windows Server 2019, 2022, and 2025 on a VPS using the five possible methods: Retail/OEM, MAK, KMS, AVMA (often forgotten), and the legal renewal of the evaluation period. By the end, you will know which method to choose, how to apply it with a PowerShell command, and how to troubleshoot errors 0xC004F074, 0xC004C003, 0xC004F050.


⚡ Quick Summary - Activate in 30 Seconds (Retail/MAK Key)

Open PowerShell as administrator on the VPS and run:

slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr.vbs /ato
slmgr.vbs /xpr

Replace the X with your key. If /xpr shows permanently activated, you're done. Otherwise, see the Troubleshooting section.


Why Activate Windows Server on a VPS (and What Happens Otherwise)

When you install Windows Server (or your host provides you with a pre-installed image), three scenarios are possible:

  • Image with evaluation key - You have 180 days to activate.
  • Image without key - You see “Windows is not activated” upon first login.
  • Pre-activated image - Ideal case, possible if the host includes the license.

What Happens If You Don't Activate Before Expiration

  • Permanent banner “Activate Windows” at the bottom right of the desktop.
  • Customization blocked (unable to change wallpaper, colors).
  • Windows Update blocked on certain editions.
  • Automatic restart every hour once the evaluation period ends (most problematic in production).
  • Degraded server features (notably RDS, Active Directory, etc.).

Activation is not optional for production use. And using a pirated key exposes you to serious legal risks.


Which Activation Method to Choose?

Before running a command, identify your situation in this table:

Your Situation Method Cost Activation Time
1 isolated VPS, personal or freelance use Retail/OEM ~700-900 € Standard Immediate
Multiple VPS (5+), SME park MAK (volume licensing) Microsoft tiered pricing Immediate
More than 25 VPS, enterprise infrastructure KMS (internal KMS server) Volume license + KMS server Auto-renewal every 180 days
VPS hosted on Hyper-V Datacenter AVMA (auto) Included in Datacenter host Automatic at boot
Test, POC, ephemeral dev 180-day evaluation + rearm Legally free 540 days max

Quick Decision

  • You have 1 to 4 VPS? Buy a Retail key from an authorized Microsoft reseller (or from your host).
  • You manage 5 to 25 VPS? Switch to MAK via a Volume Licensing Center account.
  • You manage 25+ VPS or an AD domain? Set up a KMS server.
  • Your VPS runs on a Hyper-V Datacenter host? Use AVMA (free, automatic).
  • It's just a test? Take advantage of the 180-day evaluation + 2 rearms.

Prerequisites

  • A Windows Server 2019, 2022, or 2025 VPS.
  • RDP administrator access.
  • Outgoing Internet connectivity (ports 80/443 to Microsoft activation servers).
  • For KMS/AVMA: appropriate internal network connectivity.

Method 1 - Retail / OEM Activation (key purchased)

This is the simplest method: you buy a key, paste it, activate.

1.1 - Check Your Edition

Get-ComputerInfo | Select-Object WindowsProductName, OsName, OsArchitecture, WindowsEditionId

Note the exact edition (Standard or Datacenter). A Standard key does not activate a Datacenter (and vice versa).

1.2 - Check Current Activation Status

slmgr.vbs /xpr      # short status: activated or not
slmgr.vbs /dlv      # detailed status: edition, channel, expiration

1.3 - Install the Key

slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Replace the XXXXX with your Retail key (5 groups of 5 alphanumeric characters).

1.4 - Start Online Activation

slmgr.vbs /ato

This command contacts Microsoft servers. You should see:

Product activated successfully.

1.5 - Confirm Activation

slmgr.vbs /xpr

Expected result:

The machine is permanently activated.

1.6 (optional) - Activation by Phone

If Internet access is not available:

slui.exe 4

Follow the wizard: an installation ID is generated, you call the Microsoft number, you enter the confirmation ID. Immediate activation, without connection.


Method 2 - MAK Activation (Multiple Activation Key)

MAK is a unique key that allows activation of a limited number of machines (for example, 50). Ideal for an SME with multiple VPS.

Procedure (identical to Retail)

slmgr.vbs /ipk YOUR-MAK-XXXXX-XXXXX-XXXXX
slmgr.vbs /ato
slmgr.vbs /xpr

Check Remaining Activations

slmgr.vbs /dlv

Look for the line Remaining MAK activations (only for MAK). If you see 0, contact your Microsoft reseller to increase the pool.

MAK Specifics

  • One activation consumes a slot from the pool (irreversible, except via Microsoft support).
  • Destroyed then recreated VPS do not automatically free the slot.
  • For high turnover environments, prefer KMS or AVMA.

Method 3 - KMS Activation (Key Management Service)

KMS is an internal service on your network that automatically activates your servers. It requires a minimum of 5 servers to start (Microsoft activation threshold).

3.1 - Install the GVLK Key Corresponding to the Edition

GVLK keys (Generic Volume License Keys) are public and published by Microsoft. They inform the client “I am a KMS client, contact my internal KMS server.”

# For Windows Server 2022 Standard
slmgr.vbs /ipk VDYBN-27WPP-V4HQT-9VMD4-VMK7H

3.2 - Configure the KMS Server Address (if not detected via DNS)

slmgr.vbs /skms kms.your-company.com:1688

The port 1688 is the standard port for the KMS protocol.

3.3 - Force Activation

slmgr.vbs /ato

3.4 - Check KMS Connectivity

# DNS Test (if auto-configured by SRV records)
nslookup -type=srv _vlmcs._tcp.your-domain.com

# KMS Port Test
Test-NetConnection kms.your-company.com -Port 1688

KMS Specifics

  • The KMS client must reconnect to the KMS server every 180 days to maintain its activation.
  • In the absence of renewal, the state “Out of tolerance” sets in and then the activation is revoked.
  • The KMS server must itself be activated with a CSVLK (Microsoft Volume Licensing key).

Method 4 - AVMA: The Forgotten Method (but Excellent for VPS)

AVMA (Automatic Virtual Machine Activation) automatically activates Windows Server VMs running on a Hyper-V Datacenter host. No key to install, no KMS to set up. It is the simplest and least expensive method for a host - and it is what many serious hosts use internally.

Conditions

  • The physical host runs on Windows Server Datacenter (activated full edition).
  • The guest VM runs on Windows Server Standard, Datacenter, or Essentials.
  • Hypervisor = Hyper-V (does not work on KVM, VMware, Proxmox).

Procedure (on the VM side)

Install the corresponding AVMA key. It is public:

# Windows Server 2025 Standard
slmgr.vbs /ipk TVRH6-WHNXV-R9WG3-9XRFY-MY832

See the GVLK table below. For 2022/2025, the official AVMA and GVLK keys are identical.

The Hyper-V host activates the VM automatically at boot, without contacting Microsoft.

AVMA Advantages

  • ✅ No ports to open.
  • ✅ No KMS server to set up.
  • ✅ Persistent activation, no renewal every 180 days.
  • ✅ Legally covered by the Datacenter license of the host.

If your host does not use AVMA, it is often a sign that the infrastructure uses a hypervisor other than Hyper-V (KVM, VMware), in which case activation goes through KMS or Retail/MAK.


Method 5 - Evaluation Period + Rearm (legally free)

If you want to test Windows Server legally without a key, Microsoft offers:

  • 180 days of initial evaluation.
  • 2 renewals of 180 days via the rearm command.
  • Total: 540 days of free and legal use.

5.1 - Check Remaining Time

slmgr.vbs /xpr
slmgr.vbs /dli

5.2 - Start a Rearm Before Expiration

slmgr.vbs /rearm

Then restart mandatory:

shutdown /r /t 0

5.3 - Check Remaining Rearms

slmgr.vbs /dlv

Look for the line Remaining Windows rearm count. Should display 2, 1, or 0 depending on the rearms already used.

Rearm Limits

  • ❌ Is not a permanent license.
  • ❌ Maximum 2 rearms per installation (beyond that, reinstallation required).
  • Not allowed in commercial production (read the Microsoft evaluation license).
  • ✅ Perfect for testing, demo, personal lab.

Complete GVLK Key Table (public, for KMS and AVMA)

The keys below are officially published by Microsoft. They are NOT licenses: they indicate the edition to activate via your KMS infrastructure or AVMA host.

Windows Server 2025

Edition GVLK Key
Datacenter D764K-2NDRG-47T6Q-P8T8W-YP6DF
Standard TVRH6-WHNXV-R9WG3-9XRFY-MY832

Windows Server 2022

Edition GVLK Key
Datacenter WX4NM-KYWYW-QJJR4-XV3QB-6VM33
Standard VDYBN-27WPP-V4HQT-9VMD4-VMK7H
Datacenter Azure Edition NTBV8-9K7Q8-V27C6-M2BTV-KHMXV

Windows Server 2019

Edition GVLK Key
Datacenter WMDGN-G9PQG-XVVXX-R3X43-63DFG
Standard N69G4-B89J2-4G8F4-WWYCC-J464C
Essentials WVDHN-86M7X-466P6-VHXV7-YY726

⚠️ Important: these keys only work in a valid KMS or AVMA environment. Using them on a machine without a KMS server will return the error 0xC004F074.


Uninstalling an Incorrect Key

You installed the wrong key (incompatible edition, exhausted MAK, etc.)? Here’s how to clean up:

# Uninstall the current key
slmgr.vbs /upk

# Clear the key from the registry (security)
slmgr.vbs /cpky

# Check
slmgr.vbs /dlv

Then reinstall the correct key with /ipk.


Troubleshooting: Common Errors and Solutions

Error 0xC004F074 - “The Software Protection Service could not communicate with the KMS service”

Cause: no accessible KMS server, or misconfigured DNS.

Solutions:

  1. Check DNS resolution: nslookup -type=srv _vlmcs._tcp.your-domain.com
  2. Check the port: Test-NetConnection kms.your-company.com -Port 1688
  3. Force the address manually: slmgr.vbs /skms kms.your-company.com:1688
  4. Ensure at least 5 clients have already connected to the KMS (activation threshold).

Error 0xC004C003 - “The activation server determined that the specified key is blocked”

Cause: pirated key, already used too many times, or revoked by Microsoft.

Solutions:

  1. Uninstall the key: slmgr.vbs /upk
  2. Buy a legitimate key from an authorized Microsoft reseller.
  3. If you purchased the key recently, contact the seller - it is probably a fraudulent resale.

Error 0xC004F050 - “The product key is not valid for this edition”

Cause: you are installing a Standard key on a Datacenter edition (or vice versa), or a Server 2022 key on Server 2025.

Solutions:

  1. Check your edition: Get-ComputerInfo | Select WindowsProductName
  2. Retrieve the key corresponding to your exact edition.
  3. If you want to change editions, use the DISM upgrade (see Microsoft documentation).

Error 0xC004C060 - “The key is valid but cannot be used to activate this installation”

Cause: generally, an OEM key used on a VPS (OEM keys are tied to physical hardware).

Solution: use a Retail or Volume key (MAK/KMS), not OEM.

Error 0xC004F009 - “The grace period has expired”

Cause: the evaluation period is over, the server enters “notification” mode.

Solutions:

  • If rearms remaining: slmgr.vbs /rearm + restart.
  • Otherwise, buy a key and activate.

Error 0x80072EE7 - “The server name or address could not be resolved”

Cause: no Internet access to contact Microsoft servers.

Solutions:

  1. Check routing: Test-NetConnection activation.sls.microsoft.com -Port 443
  2. Check firewall and proxy.
  3. Otherwise, activate by phone: slui.exe 4.

The Server Restarts Every Hour

Cause: Windows Server out of the evaluation period and not activated.

Solution: Activate immediately (one of the 5 methods above). To temporarily stop an ongoing restart: shutdown /a.

“This copy of Windows is not genuine”

Cause: Microsoft has invalidated your key via Windows Update.

Solutions:

  1. Uninstall (/upk + /cpky).
  2. Install a legitimate key.
  3. If attempting activation via a pirated KMS tool (e.g., KMSPico, MSToolkit): clean your system, these tools often install persistent scheduled tasks.

Complete Diagnostic PowerShell Script

Copy and paste this script in PowerShell admin for a complete diagnostic in one command:

# === Windows Server Activation Diagnostic ===
Write-Host "`n=== EDITION & VERSION ===" -ForegroundColor Cyan
Get-ComputerInfo | Select-Object WindowsProductName, OsName, OsVersion, OsArchitecture | Format-List

Write-Host "`n=== ACTIVATION STATUS (short) ===" -ForegroundColor Cyan
cscript //nologo "$env:WINDIR\System32\slmgr.vbs" /xpr

Write-Host "`n=== DETAILED STATUS ===" -ForegroundColor Cyan
cscript //nologo "$env:WINDIR\System32\slmgr.vbs" /dlv

Write-Host "`n=== MICROSOFT ACTIVATION CONNECTIVITY ===" -ForegroundColor Cyan
Test-NetConnection activation.sls.microsoft.com -Port 443 | Select-Object ComputerName, RemotePort, TcpTestSucceeded

Write-Host "`n=== KMS CONNECTIVITY (if configured) ===" -ForegroundColor Cyan
$kms = (cscript //nologo "$env:WINDIR\System32\slmgr.vbs" /dlv 2>&1 | Select-String "KMS machine name").ToString()
Write-Host $kms

The result covers 90% of scenarios and indicates precisely where to look in case of a problem.


Legal Aspects: Why Avoid Pirated Keys

Microsoft is very active in tracking stolen keys, resold, or fraudulent KMS activations. Here are the real risks:

  • Remote revocation: your key can be invalidated by Windows Update overnight, and your server crashes.
  • Civil penalties: commercial use of an invalid license = counterfeiting. Microsoft regularly pursues legal action against hosts and user companies.
  • Compromised security: popular “KMS patches” (KMSPico, MS Toolkit, KMSAuto) install persistent scheduled tasks, system services, and sometimes backdoors. This is the leading cause of Windows VPS compromise in 2024-2026.
  • Blocked updates: Windows quickly detects fraudulent activations and blocks critical security updates.

Cost of a Legitimate Key vs Risk

  • Windows Server 2022 Standard : ~700-900 € one-time (lifetime 10+ years).
  • Sometimes included in monthly VPS packages (~20-40 €/month depending on resources).

If your budget is limited, use the 180-day eval period + 2 rearms = 540 days free legally. This is more than enough to finish a project or test a stack.


FAQ - Windows Server License on VPS

How do I know if my Windows Server VPS is activated?

Run slmgr.vbs /xpr in PowerShell. If the message contains permanently activated, your server is activated. If you see evaluation or a countdown in days, you are in the evaluation period. If you see Notification mode, the activation has expired and the server will restart every hour.

What is the command to activate Windows Server on a VPS?

Three successive commands in PowerShell admin: slmgr.vbs /ipk YOUR-KEY-XXXXX-XXXXX-XXXXX-XXXXX, then slmgr.vbs /ato to contact Microsoft, then slmgr.vbs /xpr to confirm.

How much does a Windows Server 2022 / 2025 license cost?

A Retail Standard license costs about 700-900 euros for 16 cores (expandable). A Datacenter license costs 5× to 7× more. For a VPS, check if the host includes the license in their offer, which is significantly cheaper than a direct purchase.

How long can you use Windows Server for free?

540 days maximum: 180 days of initial evaluation + 2 rearms of 180 days each, triggered by slmgr.vbs /rearm. This usage is legal, but Microsoft specifies in its T&Cs that it is reserved for testing and evaluations, not for commercial production use.

What is the difference between KMS, MAK, and AVMA?

  • MAK = unique key that activates up to N machines consuming N slots from a pool - ideal for 5-25 stable machines.
  • KMS = internal server that activates clients for 180 renewable days - ideal for 25+ machines in a dynamic environment.
  • AVMA = automatic activation of Windows Server VMs running on a Hyper-V Datacenter host - the simplest if the host is under Hyper-V Datacenter.

Why does my VPS restart every hour?

This is the default behavior when the evaluation period has expired and the machine is not activated. There is only one solution: activate the license (or reinstall to start a new evaluation cycle). To stop an ongoing restart: shutdown /a.

Can I use KMSPico or MS Toolkit on a VPS?

Legally no, and technically highly discouraged. These tools install scheduled tasks and persistent services that are the primary cause of malware infection on Windows VPS. Additionally, Microsoft regularly revokes activations from these tools. Prefer the 180-day evaluation or a legitimate key.

Does an OEM key work on a VPS?

No. OEM keys are tied to physical hardware (server motherboard). On a VPS, you will consistently receive the error 0xC004C060. Use a Retail or Volume key (MAK/KMS).

How to change the key on an already activated VPS?

slmgr.vbs /upk (uninstall the current key), then slmgr.vbs /cpky (clear from the registry), then slmgr.vbs /ipk NEW-KEY… (install the new one), then slmgr.vbs /ato (activate).

Is Windows Server activation lost if I restart the VPS?

No. A Retail, MAK, or AVMA activation is persistent at the operating system level, it survives all restarts. Only a KMS activation must renew every 180 days with the internal KMS server.


Conclusion

Activating Windows Server on a VPS boils down to three choices: pay for a Retail/MAK key (the simplest), set up a KMS (cost-effective beyond 25 servers), or take advantage of the 540 days of legal evaluation (perfect for testing). The AVMA is an excellent option but depends on your host's hypervisor.

Whatever your choice, absolutely avoid pirate KMS "patches": legal risks, technical instability, and the primary entry point for malware on Windows VPS in production.