What the error means
Error 0xC004F042 appears when you try to activate a Windows system and the Software Licensing Service decides that the Key Management Service (KMS) it was pointed at cannot be used. In Windows Script Host the message reads that the Software Licensing Service determined that the specified KMS cannot be used. Microsoft's article says the error might occur if you have multiple KMS hosts that activate different sets of KMS clients. The troubleshooting steps apply to physical computers, on-premises virtual machines and Azure virtual machines.
In practice, the KMS client reached a KMS host, but that host is not able to activate the client software. Microsoft calls this common in mixed environments that have application-specific and operating system-specific KMS hosts.
Common causes
- The KMS client is configured to contact a self-hosted KMS server that does not support the Windows edition installed on the client.
- The KMS host key does not match the product being activated. Microsoft's example is trying to use a Windows Server 2016 KMS key to activate a Windows Server 2022 client.
- The client was migrated from an on-premises environment that uses a different KMS infrastructure, so it still points at the old host.
How to fix it
Microsoft's resolution is to make sure the KMS clients connect to the correct hosts. This matters most when specific KMS hosts are used for specific applications or operating systems. The article assumes you are familiar with the slmgr script.
1. Open an administrative Command Prompt
Open a Command Prompt window as administrator on the client that shows the error.
2. Clear the existing KMS host setting
Run the following command to remove any KMS host the client has stored:
cscript c:\windows\system32\slmgr.vbs /ckms3. Specify the correct KMS host
Run the following command, replacing the placeholders with the fully qualified domain name (FQDN) of the KMS host and the port that host uses:
cscript c:\windows\system32\slmgr.vbs /skms <KMSHost_fqdn>:<KMSHost_Port>To activate an Azure VM by using the Azure KMS service, Microsoft says to use azkms.core.windows.net as the host and 1688 as the port.
4. Try to activate again
Run the activation command and check the result:
cscript c:\windows\system32\slmgr.vbs /atoThis is a general step: ask your KMS administrator which host is meant to serve this Windows edition before you change the setting, because a wrong host will only produce the same error again.
If nothing works
Confirm with the KMS administrator that the KMS host key supports the Windows version and edition on the client. For Azure virtual machines, Microsoft refers to its pages on troubleshooting Windows activation problems and the troubleshooting tools for Windows activation on Azure VMs. Microsoft also links its general article on Windows activation error codes.
What we checked
One official Microsoft Learn page was read on 2026-11-25: the article on error 0xC004F042 when activating Windows. It gives the message text, the causes, and the slmgr steps. The error was not reproduced for this page.
Last checked: 2026-11-25.