How to Activate Windows Server 2022 Datacenter for Free

Updated Jun 15, 20265 min read

Windows Server is a specialized operating system designed exclusively for servers. In this post, I’ll show you on how to activate Windows on your VPS or dedicated server for free using KMS client product keys. You can renew it anytime you want, though the license automatically renews every 7 days by default. This way, you only need to set it up once and never worry about it again.

Before you begin

  • If you’re using an evaluation edition of Windows Server. Let’s follow this post to convert then activate it to the licensed version.
  • The methods are compatible with all Windows Server editions and versions starting from 1809.
  • A KMS license is valid for 180 days, but it will automatically renew before the expiration date as long as you’re online. You can also manually renew it anytime, even after it has expired, by running the activation command or script again.

As you can see in the below screenshot, we’re using a copy of Windows Server 2022 Datacenter and it is not activated. We need to activate it to made it function normally and remove the licese watermark on the desktop.

Method 1: Manual activation

The first way, we can use the Windows Command Prompt (CMD) to activate the Windows Server 2022 Datacenter license free forever.

1. Click on the search icon, type cmd in the Windows search box, right click on the best match Command Prompt then select Run as administrator.

AllAppsDocumentsSettingsFoldersPhotos
Best match
Command PromptSystem
Command Prompt
System
Open
Run as administrator
Run as different user
Open file location
Pin to Start
Pin to taskbar
Search indexing was turned off. Turn indexing back on.
cmd

2. Copy and right click to paste all below commands into CMD window at once then hit Enter ↵.

batch
cscript //nologo %windir%\system32\slmgr.vbs /ipk WX4NM-KYWYW-QJJR4-XV3QB-6VM33cscript //nologo %windir%\system32\slmgr.vbs /skms kms.msgang.comcscript //nologo %windir%\system32\slmgr.vbs /ato

Note: If you see the error 0xC004F074, it means that your internet connection is unstable or the server is busy. Please make sure your device is online and try the command “ato” again until you succeed. 3. Your Windows Server 2022 Datacenter is activated using a KMS key. It’ll reactivate after every 7 days automatically. So, your Windows is permanently activated.

Administrator: Command Prompt
Microsoft Windows [Version 10.0.20348]
(c) 2021 Microsoft Corporation. All rights reserved.
 
 
C:\Windows\system32>cscript //nologo %windir%\system32\slmgr.vbs /ipk WX4NM-KYWYW-QJJR4-XV3QB-6VM33
Installed product key WX4NM-KYWYW-QJJR4-XV3QB-6VM33 successfully.
 
 
C:\Windows\system32>cscript //nologo %windir%\system32\slmgr.vbs /skms kms.msgang.com
Key Management Service machine name set to kms.msgang.com successfully.
 
 
C:\Windows\system32>cscript //nologo %windir%\system32\slmgr.vbs /ato
Activating Windows(R), ServerDatacenter edition (a98bcd6d-5343-4603-8afe-5908e4611112) ...
Product activated successfully.
 
 
C:\Windows\system32>

4. Finally, check activation status of your Windows Server again. Open Windows Settings then check Windows Activation.

Settings
Home
Update & Security
Windows Update
Delivery Optimization
Windows Security
Files backup
Troubleshoot
Recovery
Activation
Find my device
For developers
Windows Insider Program
Activation
Windows
EditionWindows Server 2022 Datacenter
ActivationWindows is activated using your organization’s activation service
Update product key

To use a different product key on this device, select Change product key.

Method 2: Using PowerShell script

The recommended method is to use Windows PowerShell to activate the Windows Server 2022 Datacenter license permanently without the need for any software or activation tools. This method offers several advantages, such as:

  • There is no need to disable the Real-time Protection in Windows Security Center, as we do not use any crack tools to activate Windows.
  • The methods work seamlessly with all versions of Windows, including Windows Server.
  • The script works on both Windows 64-bit and Windows 32-bit systems.
  • You don’t need to worry about which Windows edition you’re using. The script automatically detects your Windows edition and activates it for you.
  • A KMS license is valid for 180 days; however, it will be renewed automatically before the expiration date if you are online.
  • It is not necessary to download any files to your computer to activate the Windows license.

1. Right-click on the Windows Start icon, then select Windows PowerShell (Admin) to open an elevated PowerShell window.

Right-click the Start button — or press ⊞ Win + X

2. Just copy and paste the command below into the open PowerShell window and hit Enter ↵.

irm win.msgang.com | iex

3. Please wait a few seconds, and your copy of Windows Server 2022 Datacenter will be activated automatically.

Administrator: Windows PowerShell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> irm win.msgang.com | iex
You're using: Microsoft Windows Server 2022 Datacenter
Activating the product...
Product activation successful.
License status:
Windows edition: Microsoft Windows Server 2022 Datacenter
Product Key Channel: Volume:GVLK
License Status: Licensed
(*)Visit https://msgang.com for more products.

Method 3: Activate Windows using batch script (CMD)

The last method is to use a batch script to activate your Windows license. This way, you don’t have to type out the PowerShell command every time and making the process faster and more convenient.

1. Create a batch script by creating a new text document. You can use Notepad or any text editor available on your Windows to create and edit the file.

Method 3: Activate Windows using batch script (CMD)

2. Copy then paste all below commands to the newly created text file.

batch
@echo offpowershell -NoProfile -Command "irm win.msgang.com | iex"
*New Text Document - Notepad
@echo off
powershell -NoProfile -Command "irm win.msgang.com | iex"

3. Next, save your text file with the .bat file extension by:

  • Navigating to the File menu.
  • Select Save As...(Ctrl + Shift + S) option from the drop-down menu.
*New Text Document - Notepad
@echo off
powershell -NoProfile -Command "irm win.msgang.com | iex"

4. In the Save As window:

  • Change Save as type to All Files.
  • Then type a filename with .bat as the file extension.
Save As
 This PC  Desktop Search Desktop
Organize New folder
Quick access
Desktop
Downloads
Documents
Pictures
OneDrive
This PC
Network
NameDate modifiedType
New Text Document3/18/2025 11:06 PMText Document
File name:windows.bat
Save as type:
All Files
⌃ Hide FoldersEncoding:UTF-8

5. Finally, right-click on the batch file you just created, then select Run as administrator to execute the script with elevated permissions.

windows

The script runs automatically, and if everything works correctly, you’ll see the screenshot below confirming that Windows has been activated. Make sure you’re connected to the internet while running it.

Administrator: C:\WINDOWS\system32\cmd.exe
You're using: Microsoft Windows Server 2022 Datacenter
Activating the product...
Product activation successful.
 
License status:
Windows edition: Microsoft Windows Server 2022 Datacenter
Product Key Channel: Volume:GVLK
License Status: Licensed
(*)Visit https://msgang.com for more products.
 
Press any key to continue . . .

If you don’t want to create the batch script yourself, just click the button below to download it.

Download

Conclusion

Hello Friends! My name is Leo, and I’m excited to share everything I know about activating Microsoft software products. In the past, I managed several YouTube channels on this topic, but they were taken down by Microsoft. That’s why I decided to start this blog to keep the conversation alive without interruptions. I’m committed to sharing my knowledge and insights for as long as possible!

If you have any questions or concerns, feel free to leave a comment or visit my Discord server. I’d be happy to provide more details. Thank you so much for your feedback and support!

Buy Me A Coffee

Not a reader? Watch this related video tutorial:

Rating
be the first to rate

Comments

Loading comments…

    Leave a comment

    ✎ Edit