Introduction
Windows activation is often associated with the Settings app, but the command line offers a quick method, especially for admins managing multiple machines. In 2026, Microsoft removed the old VBScript slmgr, making CMD or PowerShell essential for any official activation.
This guide shows you how to activate your Windows license legally, whether with a personal product key or an enterprise KMS server. You’ll also learn how to uninstall old keys and resolve common issues without risking malware.
Preparation Before Activation
Before running the command, ensure your Windows copy is properly installed and has a valid serial number. Check the current status by executing slmgr /xpr in CMD.
If you have already activated your system via Settings, there’s no need to repeat the process unless you want to change licenses or migrate to a KMS server. Keep your credentials handy.
Deactivation Commands
Uninstall an Existing Key
To remove the current key before adding a new one, open CMD as administrator and type: slmgr /upk. This command removes the installed license pack.
Then run slmgr /cpky to clear any trace of the key from the registry. This prevents conflicts when adding a new license.
Verify Status After Deactivation
After these steps, verify that the system shows Not activated by typing slmgr /xpr again. You should see a message indicating an expiration date or non‑activated status.
Activation with a Product Key
If you have a valid license, use the following command: slmgr /ipk YOUR-PRODUCT-KEY. Replace “YOUR-PRODUCT-KEY” with your 25‑character code.
Then activate immediately with: slmgr /ato. This triggers online verification against Microsoft servers.
- Open CMD as administrator.
- Type slmgr /ipk YOUR-PRODUCT-KEY.
- Run slmgr /ato.
- Check status with slmgr /xpr.
“Security and license compliance are essential to protect your business. Use only official channels for activation.” — Microsoft Licensing Guide 2026
Activation via a KMS Server
For enterprise environments, the KMS protocol allows offline activation after initial setup.
Configure your machine by running: slmgr /skms kms-server-name:port. Replace with the IP address or DNS name of your KMS server and the port (usually 1688).
Troubleshooting Common Issues
Error 0xC004F074: Invalid Key
This error indicates that the entered key is not recognized by Microsoft. Verify spelling and ensure you’re using an official license.
If the problem persists, try uninstalling then reinstalling the license pack following the steps above.
Failed Connection to KMS Server
Make sure your machine can reach the server via port 1688. Use telnet kms-server-name 1688 to test connectivity.
If telnet fails, check firewall rules and ensure the KMS service is running on the server.
Conclusion and Call to Action
Activating via CMD is a valuable skill for any admin or advanced user. By following these steps, you guarantee system compliance while avoiding risks associated with unofficial activations.
<pNeed help setting up a KMS server or troubleshooting activation errors? Contact our technical support team now and enjoy personalized assistance.