skip to content
Maathuran's Blog
Setting up internal KMS server for LAB use

Setting up internal KMS server for LAB use

/ 2 min read

Last Updated:

Introduction

Another nice resource to learn about is how Microsoft KMS works in organizations. This is useful for large enterprises to have a central Server responsible for handling Activation for all their Windows computers. We will implement this in our Lab by running an open-source KMS in Python.

Installing pyKMS

The easiest way to get pyKMS running is by using the Docker Compose file listed here https://py-kms.readthedocs.io/en/latest/Getting%20Started.html#docker-compose.

Portainer Stack

In our Portainer instance, we will add a new stack called pykms and paste it into the Docker Compose file from above. PT1

As we do not need any additional environmental variables, we can scroll down and click on Deploy the stack. PT2

The Portainer will check to see if the image can be downloaded and if the compose file is correct. If everything is right, you will get a success popup. PT2

You can navigate to Container to see if the new stack is running, and you can see which ports are getting exposed PT3

You can click on the 8080:8080 to pull up the Web Gui of pyKMS to see if any clients are using the KMS server PT4

Activation Windows Server 2022

After the desktop loads on the Windows Server, click Start, then type in CMD and launch it as admin WD5

In CMD, type in the following slmgr.vbs /ipk <kms-key> where <kms-key> is the correct key for your Windows server version from here https://learn.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys#generic-volume-license-keys-gvlk WD6

You will get this popup if it worked WD7

The next step will be adding your KMS host IP and port. Type in slmgr.vbs /skms <host>:<port>, then hit enter WD8

You will get this popup WD9

The Final step is to activate it against the custom KMS server. Type in the following slmgr.vbs /ato WD10

After a couple of seconds, you will get a successfully activated message. WD10

Another way to check is by going into Windows -> Settings -> Update & Security -> Activation WD11

On pyKMS’s web Gui, you should be able to see which computers have requested Activation PY12