Fix Windows slmgr Error 0xC004F074 No KMS Server could be contacted
Error 0xC004F074 request time-out when the activation service tries to contact the KMS server
I was trying to fix a windows machine not being able to activate using a valid KMS server. After setting the KMS server using the command
slmgr /skms <server-name>
and initiating the activation
slmgr /ato
The request times-out and gives the error code 0xC004F074. After digging through google for a solution, I found none.
I then decided to look deeper and fired Wireshark to look at the actual request. I found out that the machine tries to activate to a server with the ip 192.168.1.255 even though I had set it manually with slmgr /skms to a different one.
After spending some time searching through the Registry Editor, I found the rogue key. The SoftwareProtectionPlatform key has the configuration for the Windows activation.
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform
The KeyManagementServiceName string value is the one you set with /skms. However, there were other child keys under SoftwareProtectionPlatform that have these name patterns xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. They also contain a KeyManagementServiceName string value, so deleting them or changing their values to the proper server name solved the issue.
I believe this was caused by the installation of shady KMS activation crapware by whoever setup this machine before.