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

SwitchDescription
/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

SwitchDescription
/cpkyClear the product key from the registry (prevents recovery from memory dumps).
/ilc <FilePath>Install a licence file.
/rilcRe-install system licence files.
/rearmReset 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

SwitchDescription
/skms <Name[:Port]>Set the KMS host name and port used by the client.
/ckmsClear the configured KMS host and revert to DNS auto-discovery.
/skms-domain <FQDN>Set the DNS domain used for KMS SRV lookup.
/ckms-domainClear the KMS lookup domain.
/skhcEnable KMS host caching on the client.
/ckhcDisable KMS host caching.

KMS host options

SwitchDescription
/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.
/sdnsEnable DNS SRV record publishing.
/cdnsDisable DNS SRV record publishing.
/spriSet KMS process priority to Normal.
/cpriSet KMS process priority to Low.

Common issues

  • Output appears in pop-up dialogs. The default wscript host renders dialogs; prefix the command with cscript for console output.
  • Access denied on /ipk or /ato. The command prompt is not elevated. Right-click and choose Run as administrator, or use sudo on 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 /skms changes.

References

  1. Slmgr.vbs options for volume activationhttps://learn.microsoft.com/en-us/windows-server/get-started/activation-slmgr-vbs-options
  2. Activate using Key Management Servicehttps://learn.microsoft.com/en-us/windows-server/get-started/activation-key-management-services
  3. Plan for volume activationhttps://learn.microsoft.com/en-us/windows/deployment/volume-activation/plan-for-volume-activation-client
  4. Volume Activation overviewhttps://learn.microsoft.com/en-us/windows/deployment/volume-activation/volume-activation-windows-10