If you ever find yourself in the position whereby you need to enforce a machine to use a particular KMS server or port then read on.
Equally if you have a machine that doesn’t seem to read the KMS server _vlmcs srv records from DNS then check this.
If you browse the registry with regedit and go to the following key:
You can add (or look for) the following string values:
This is how it will look in your registry:
These are fairly self-explanatory, the service name is the KMS server and the service port is the TCP port used for contacting the KMS server.
If they don’t appear simply add them in as string values. If they do appear you can either amend them or simply delete them.
If you need to perform a mass add or delete then you have a few options. GPO is one if you’re in an active directory environment, another is to create a .reg file and deploy it either with group policy or SCCM or even manually with something like psexec if you need to.
Create a new GPO for the required KMS change.
Edit the GPO with the following:
Computer Configuration>Preferences>Windows Settings>Registry
Add 2 new registry items to delete or add (whichever suits you) and Apply once only:
Then all you need to do is attach the GPO to the relevant OU’s containing machine objects.
If you want to create a .reg file that adds values I always find it’s best to add them into the registry manually on a test machine and then export those values into a .reg file. Open the file with your favourite text editor (notepad etc) and you’ll need to clear out all of the other values and their data and you should be left with something like this:
Windows Registry Editor Version 5.00
Equally if you want to remove the KMS values altogether then your .reg file should look something like this:
Windows Registry Editor Version 5.00
Save this as a .reg file you can then run it against your target machine using your preferred method. If you want to run the file silently then the command you will require is as follows:
regedit /s KMSRegDelete.reg
See this Microsoft Article for full details about modifying the registry using a .reg file. http://support.microsoft.com/kb/310516
8 thoughts on ““Hard code” your KMS server into the registry”
This is awesome! Spent seven hours lurking around forums and tracing TCP connections and firewall rules, when this was the answer all along! I had tried using the /skms to no effect, and this made all the difference! Congrats!
Glad to hear it was of use to you. Thanks for the comment.
Pingback: Virtually Cloudy » “Hard code” your KMS server into the registry | IT by me
Thanks, Registry key is working for windows clients.
I installed office 2010 kms on the same server, is there any registry settings for office 2010 kms clients.
This has been bugging me for a month. I was able to hard set the clients by running ospp.vbs /sethst but that’s what got me in this mess to begin with. I do have some adjustments with your fix to remove the entries, partly because I’m doing Office 2013. See adjusted registry path:
Also, I copied and pasted your registry edits directly into notepad but the double quotes were messing it up. I then did an export of the existing key and compared and noticed that the quotes were different. I used the proper quotes above and hope that this site doesn’t change them after I post. Anyway, thanks for pointing me in the right direction.
Nope. After posting the quotes get changed to curlier versions.
what may be instances where we remove the KMS entries from registry? I too have issues activating 2016 servers. tried all slmgr commands but to no avail. any suggestions would be helpful
For me it just works after using “cscript ospp.vbs /sethst” on client PC. Modifying the registry entries alone did not fix the issue.
How can I implement the same using GPO/registry keys?
Comments are closed.