IT & Networking

Manage KMS Server Commands

Understanding and utilizing KMS Server Commands is fundamental for anyone managing a Microsoft Key Management Service (KMS) environment. These powerful commands, primarily executed through the slmgr.vbs script, enable administrators to activate Windows and Office products across an organization, monitor activation status, and troubleshoot common issues. Mastering these KMS Server Commands ensures your systems remain properly licensed and operational.

Understanding the slmgr.vbs Tool

The slmgr.vbs (Software Licensing Management Tool) is a command-line utility used for configuring licensing on Windows systems. It’s the primary interface for executing KMS Server Commands, whether you are managing a KMS client or configuring a KMS host server. This versatile tool allows for both local and remote management of activation settings.

You must run the Command Prompt or PowerShell with administrative privileges to use these KMS Server Commands effectively. Failure to do so will result in permission errors and prevent successful execution of the commands.

Essential KMS Server Commands for Client Management

When managing client machines that connect to a KMS host, several specific KMS Server Commands are invaluable. These commands help clients discover the KMS host, attempt activation, and display their current licensing status.

Displaying Activation Information

  • slmgr.vbs /dli: This command displays a concise summary of the current license, including the activation ID, installation ID, and the partial product key. It’s one of the most frequently used KMS Server Commands for a quick check.

  • slmgr.vbs /dlv: Provides a more verbose output of the license information. This includes the activation ID, installation ID, remaining Windows rearm count, and the KMS machine name and port if activated via KMS. This is crucial for detailed troubleshooting with KMS Server Commands.

  • slmgr.vbs /xpr: Shows the expiration date of the current license. For KMS clients, this will typically indicate that the license will expire in 180 days, as KMS activations are valid for this period and are renewed automatically. This is a quick way to verify active KMS client status.

Installing a KMS Client Key

slmgr.vbs /ipk <ProductKey>: This command installs a 25-character product key. For KMS clients, this would be a Generic Volume License Key (GVLK). It prepares the system to seek activation from a KMS host. Using the correct GVLK is a critical first step in the KMS activation process.

Setting the KMS Host

slmgr.vbs /skms <KMSHostNameOrIP>[:<Port>]: This KMS Server Command specifies the name or IP address of the KMS host server that the client should attempt to contact for activation. If a port is not specified, the default KMS port (1688) is used. Manually setting the KMS host is often necessary in environments where DNS SRV records are not configured or are failing.

Activating the System

slmgr.vbs /ato: This command forces an immediate attempt to activate Windows against the configured KMS host. If the client has successfully contacted the KMS host and met the activation threshold, it will activate. This is a vital troubleshooting command among the KMS Server Commands when an activation issue arises.

Clearing KMS Host Information

slmgr.vbs /ckms: This command clears any manually set KMS host name or IP address from the client. After clearing, the client will revert to discovering KMS hosts via DNS SRV records. This is useful when moving clients between different KMS environments.

Setting the KMS Port

slmgr.vbs /skms-port <PortNumber>: While less common for clients, this command allows you to specify the port number the client will use to contact the KMS host. The default is 1688.

Removing a Product Key

slmgr.vbs /upk: This command uninstalls the currently installed product key, placing the system into an unlicensed state. This is often done before re-imaging a machine or changing its licensing method.

Re-arming

slmgr.vbs /rearm: This KMS Server Command resets the licensing status of the computer, extending the grace period for activation. It is typically used for evaluation purposes or when preparing a generalized Windows image.

KMS Server Commands for Host Management

Managing the KMS host server itself also involves specific KMS Server Commands. These are crucial for setting up and maintaining the server that provides activation services to clients.

Installing a KMS Host Key

slmgr.vbs /ipk <KMSHostKey>: This command installs the specific KMS host key (CSVLK) on your KMS server. This key is different from the GVLK used on clients. It enables the server to function as a KMS host.

Activating the KMS Host

slmgr.vbs /ato: After installing the KMS host key, this command activates the KMS host against Microsoft’s activation servers. The KMS host only needs to be activated once.

Checking KMS Host Status

slmgr.vbs /dli all or slmgr.vbs /dlv all: These commands, executed on the KMS host, display detailed information about all installed licenses, including the KMS host key and the current count of activations served. This is essential for monitoring the health of your KMS service and ensuring it meets the activation threshold for clients.

Troubleshooting Common KMS Issues using Commands

Many common KMS activation problems can be diagnosed and resolved using the KMS Server Commands discussed. For instance, if a client isn’t activating, you might use /dlv to check its current status, /skms to ensure it’s pointing to the correct host, and /ato to force an activation attempt. On the KMS host, /dlv all helps verify if the host is active and has served enough activations.

Best Practices for Using KMS Server Commands

  • Always Run as Administrator: Ensure your command prompt or PowerShell session has administrative privileges for all slmgr.vbs KMS Server Commands.

  • Verify Product Keys: Double-check that you are using the correct GVLK for clients and the appropriate KMS host key for the server.

  • Monitor Activation Counts: Regularly use slmgr.vbs /dlv all on your KMS host to ensure it is meeting the minimum activation threshold (typically 5 for servers and 25 for clients).

  • Check Network Connectivity: Ensure clients can reach the KMS host on port 1688 (or your custom port) through firewalls.

  • Document Changes: Keep a record of any manual KMS Server Commands applied, especially those changing KMS host settings on clients.

Conclusion

The array of KMS Server Commands provides administrators with robust tools for managing product activations efficiently. From setting client KMS hosts to activating the host server itself, these commands are indispensable for maintaining a compliant and stable Microsoft environment. By understanding and routinely applying these slmgr.vbs commands, you can ensure seamless activation and minimize licensing-related disruptions across your network. Regularly review your KMS setup and leverage these commands to keep your systems properly licensed.