Hosting your own kms server via docker

activate your windows and office installations

In this post I will show you how to host your own kms server via docker. This is useful if you want to activate your Microsoft Windows and/or Microsoft Office installations.

⚠️ Disclaimer: only do this if you have a valid license, that you maybe lost due to hardware changes, or other reasons. I am not responsible for any illegal use of this information.

Basically what the kms server does is, it pretends to be a Microsoft server and activates your Microsoft Windows and/or Microsoft Office installations. This is done by using a generic volume product license key and a random ePID (ePID is a unique identifier for your installation). The kms server will then activate your installation for 180 days. After that you have to activate it again, so for example if you have a server that is always running, you can just activate it once and forget about it.

It just says YES to every activation request, so you can activate as many installations as you want.

Prerequisites

  • docker installed on your machine
  • unactivated Microsoft Windows or Microsoft Office installation

Install kms server

docker run command

start the container with following docker command:

docker run -d --name kms --restart=unless-stopped -p 1688:1688 mikolatero/vlmcsd

check the container logs with:

docker logs kms

your logs should look like this:

2024-01-23 19:04:21: Read KMS data file version 2.0 //vlmcsd.kmd
2024-01-23 19:04:21: Listening on [::]:1688
2024-01-23 19:04:21: Listening on 0.0.0.0:1688
2024-01-23 19:04:21: Using CSVLK Windows (Windows Server 2019) with random ePID xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
2024-01-23 19:04:21: Using CSVLK Office2010 (Office 2010) with random ePID xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
2024-01-23 19:04:21: Using CSVLK Office2013 (Office 2013) with random ePID xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
2024-01-23 19:04:21: Using CSVLK Office2016 (Office 2016) with random ePID xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
2024-01-23 19:04:21: Using CSVLK WinChinaGov (Windows 10 China Government) with random ePID xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
2024-01-23 19:04:21: Using CSVLK Office2019 (Office 2019) with random ePID xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
2024-01-23 19:04:21: vlmcsd xxxx-x-xxxx, built 2022-08-11 06:38:46 UTC started successfully

Activate Windows

main activation

  1. open cmd with the following key combination: Windows + R and type cmd and press Enter OR open it as administrator via the windows context menu

  2. get the generic volume product license key from here (different depending on which windows version you want to activate)

  3. execute following commands and dont forget to replace XXXXX-XXXXX-XXXXX-XXXXX-XXXXX with your generic volume product license key, as well as DOCKER_IP with the ip address of your docker host. If it is running on the same machine you can use localhost or 127.0.0.1.

slmgr.vbs -upk
slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr.vbs -skms DOCKER_IP
slmgr.vbs -ato
slmgr.vbs -dlv
  1. check if your windows is activated under Settings > System > Activiation under Windows 11 or Control Panel > System and Security > System under Windows 10

good to knows

  • slmgr.vbs -upk uninstalls the current product key
  • slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX installs the new product key
  • slmgr.vbs -skms DOCKER_IP sets the kms server ip address
  • slmgr.vbs -ato activates the windows installation
  • slmgr.vbs -dlv shows you the current license status

Activate Office

it is also possible to activate your Microsoft Office installation with the kms server.

The process is similar to the windows activation.

configuration.xml

open the link https://config.office.com/deploymentsettings and create/download a configuration.xml

should look like this:

<Configuration ID="uniqueuid">
  <Add OfficeClientEdition="64" Channel="PerpetualVL2021">
    <Product ID="ProPlus2021Volume" PIDKEY="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX">
      <Language ID="de-de" />
      <ExcludeApp ID="Access" />
      <ExcludeApp ID="Lync" />
      <ExcludeApp ID="OneDrive" />
      <ExcludeApp ID="OneNote" />
      <ExcludeApp ID="Publisher" />
    </Product>
  </Add>
  <Property Name="SharedComputerLicensing" Value="0" />
  <Property Name="FORCEAPPSHUTDOWN" Value="FALSE" />
  <Property Name="DeviceBasedLicensing" Value="0" />
  <Property Name="SCLCacheOverride" Value="0" />
  <Property Name="AUTOACTIVATE" Value="1" />
  <Updates Enabled="TRUE" />
  <RemoveMSI />
  <AppSettings>
    <User Key="software\microsoft\office\16.0\excel\options" Name="defaultformat" Value="51" Type="REG_DWORD" App="excel16" Id="L_SaveExcelfilesas" />
    <User Key="software\microsoft\office\16.0\powerpoint\options" Name="defaultformat" Value="27" Type="REG_DWORD" App="ppt16" Id="L_SavePowerPointfilesas" />
    <User Key="software\microsoft\office\16.0\word\options" Name="defaultformat" Value="" Type="REG_SZ" App="word16" Id="L_SaveWordfilesas" />
  </AppSettings>
</Configuration>

then you have to download the officedeployment tools and extract it in the Downloads folder, you get the file from here

if you have the file in the Downloads folder, you can execute following commands in cmd:

cd Downloads
setup /download configuration.xml
setup /configure configuration.xml

now you have to wait until it downloads Office to your machine (from the offical Microsoft CDN)…

when it is finished, you can check if it was activated successfully under File > Account in any Office application.

Troubleshooting

Under some circumstances it is possible that your Office installation is not activated yet. you have to execute following commands in cmd:

the XXXXX-XXXXX-XXXXX-XXXXX-XXXXX is the generic volume product license key for your selected Office version, you can find it here or in your configuration.xml file.

the DOCKER_IP is the ip address of your docker host. If it is running on the same machine you can use localhost or 127.0.0.1.

Office x86

cd \Program Files (x86)\Microsoft Office\Office16
cscript ospp.vbs /sethst:DOCKER_IP
cscript ospp.vbs /inpkey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
cscript ospp.vbs /act
cscript ospp.vbs /dstatusall

Office x86_64

cd \Program Files\Microsoft Office\Office16
cscript ospp.vbs /sethst:DOCKER_IP
cscript ospp.vbs /inpkey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
cscript ospp.vbs /act
cscript ospp.vbs /dstatusall

good to knows

  • cscript ospp.vbs /sethst:DOCKER_IP sets the kms server ip address
  • cscript ospp.vbs /inpkey:xxxxx-xxxxx-xxxxx-xxxxx installs the new product key
  • cscript ospp.vbs /act activates the office installation
  • cscript ospp.vbs /dstatusall shows you the current license status
Built with Hugo
Theme Stack designed by Jimmy