slmgr Command Reference
slmgr.vbs — Windows Software Licensing Management Tool
slmgr.vbs is the Windows Software Licensing Management Tool, a Visual Basic script located at C:\Windows\System32\slmgr.vbs that exposes the Software Protection Platform API to administrators from the command line. It is the supported means of installing product keys, querying activation state, and configuring KMS client and KMS host behaviour on Windows.
The script is part of every supported Windows edition. Its options are grouped into four broad categories: global, advanced, KMS client, and KMS host. All state-modifying operations require an elevated command prompt.
See also: Software Protection Platform, Key Management Service, Activation Error Codes.
History
slmgr.vbs shipped with Windows Vista as part of Volume Activation 2.0 and has been present in every subsequent Windows release. Its command set has been extended over time to cover Active Directory-Based Activation (/ad-activation-online family), Token-Based Activation, the digital licence (/atp for telemetry purposes), and Subscription Activation, but its core syntax has remained stable.
Technical details
The script invokes the SoftwareLicensingService WMI provider in the root\CIMV2 namespace. By default it displays output in graphical message boxes; running through cscript slmgr.vbs directs output to standard output, which is preferable in scripts and remote sessions. Remote management is supported via the optional <ComputerName> <User> <Password> arguments that precede any option.
Global options
| Switch | Description |
|---|---|
/ipk <ProductKey> | Install a product key. |
/ato [ActivationID] | Activate Windows (optionally a specific licence). |
/dli [ActivationID | All] | Display basic licence information. |
/dlv [ActivationID | All] | Display detailed licence information. |
/xpr [ActivationID] | Display the activation expiration date. |
Advanced options
| Switch | Description |
|---|---|
/cpky | Clear the product key from the registry (prevents recovery from memory dumps). |
/ilc <FilePath> | Install a licence file. |
/rilc | Re-install system licence files. |
/rearm | Reset the activation timers (limited to a small number of uses per image). |
/upk [ActivationID] | Uninstall the current product key. |
/dti [ActivationID] | Display the installation ID for telephone activation. |
/atp <ConfirmationID> [ActivationID] | Apply a confirmation ID returned by phone activation. |
KMS client options
| Switch | Description |
|---|---|
/skms <Name[:Port]> | Set the KMS host name and port used by the client. |
/ckms | Clear the configured KMS host and revert to DNS auto-discovery. |
/skms-domain <FQDN> | Set the DNS domain used for KMS SRV lookup. |
/ckms-domain | Clear the KMS lookup domain. |
/skhc | Enable KMS host caching on the client. |
/ckhc | Disable KMS host caching. |
KMS host options
| Switch | Description |
|---|---|
/sprt <Port> | Set the TCP port the KMS host listens on (default 1688). |
/sai <Interval> | Set the activation retry interval (unactivated clients), in minutes. |
/sri <Interval> | Set the renewal interval for activated clients, in minutes. |
/sdns | Enable DNS SRV record publishing. |
/cdns | Disable DNS SRV record publishing. |
/spri | Set KMS process priority to Normal. |
/cpri | Set KMS process priority to Low. |
Common issues
- Output appears in pop-up dialogs. The default
wscripthost renders dialogs; prefix the command withcscriptfor console output. - Access denied on /ipk or /ato. The command prompt is not elevated. Right-click and choose Run as administrator, or use
sudoon supported releases. - /rearm fails after repeated use. Each image is limited to a small number of rearms (three by default on Windows client); after the limit, the image must be re-deployed.
- /skms ignored. Group Policy or Mobile Device Management may push a fixed KMS host, which overrides local
/skmschanges.
References
- Slmgr.vbs options for volume activation — https://learn.microsoft.com/en-us/windows-server/get-started/activation-slmgr-vbs-options
- Activate using Key Management Service — https://learn.microsoft.com/en-us/windows-server/get-started/activation-key-management-services
- Plan for volume activation — https://learn.microsoft.com/en-us/windows/deployment/volume-activation/plan-for-volume-activation-client
- Volume Activation overview — https://learn.microsoft.com/en-us/windows/deployment/volume-activation/volume-activation-windows-10