“Hard code” your KMS server into the registry

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:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform

You can add (or look for) the following string values:

KeyManagementServiceName
KeyManagementServicePort

This is how it will look in your registry:

KMSRegKeys

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.

Group Policy

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:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform]
KeyManagementServiceName
KeyManagementServicePort

Then all you need to do is attach the GPO to the relevant OU’s containing machine objects.

Reg file

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

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform]

“KeyManagementServiceName”=”SERVERNAME”
“KeyManagementServicePort”=”1688”

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

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform]

“KeyManagementServiceName”=-
“KeyManagementServicePort”=-

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

6 thoughts on ““Hard code” your KMS server into the registry

  1. Pingback: Virtually Cloudy » “Hard code” your KMS server into the registry | IT by me

  2. 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.

  3. 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:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform]

    “KeyManagementServicePort”=-
    “KeyManagementServiceName”=-

    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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s