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.
As we do not need any additional environmental variables, we can scroll down and click on Deploy the stack.
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.
You can navigate to Container
to see if the new stack is running, and you can see which ports are getting exposed
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
Activation Windows Server 2022
After the desktop loads on the Windows Server, click Start
, then type in CMD
and launch it as admin
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
You will get this popup if it worked
The next step will be adding your KMS host IP and port. Type in slmgr.vbs /skms <host>:<port>
, then hit enter
You will get this popup
The Final step is to activate it against the custom KMS server. Type in the following slmgr.vbs /ato
After a couple of seconds, you will get a successfully activated message.
Another way to check is by going into Windows
-> Settings
-> Update & Security
-> Activation
On pyKMS’s web Gui, you should be able to see which computers have requested Activation