Introduction

Everyone knows that every Windows license needs to be activated before it can be fully used. The activation process is performed by the Windows Software Licensing Tool, implemented in a VBScript file named Slmgr.vbs, stored in a folder under the %SYSTEMROOT% folder (the exact position can vary according to the operating system). The script can perform several different operations and it can be also manually invoked by a system administrator to perform a series of tasks related to the administration of the Windows licenses.
Since this tool is a VBScript file, running it will make the system display a dialog box titled "Windows Script Host" that will show the result of the command's execution.

Back to top

Syntax and Options

The standard syntax of the Slmgr.vbs script is the following

slmgr.vbs [MachineName [User Password]] [<Option>]

The command line options for Slmgr.vbs are the following

  • [MachineName] - Name of a remote machine. The dafult is the local machine;
  • [User] - Account with the required privilege on the machine;
  • [Password] - Password for the account.
  • [<Option>] - Additional options.

Each additional option is described in the following subsections.

Back to top

Global Options

  • /ipk product_key - Attempts to install a 5×5 product key. The product key provided by the parameter is confirmed valid and applicable to the installed operating system. If not, an error is returned. If the key is valid and applicable, the key is installed. If a key is already installed, it is silently replaced.
  • /ato [Activation ID] - For retail editions and volume systems with a KMS host key or a Multiple Activation Key (MAK) installed, /ato prompts Windows to attempt online activation. For systems with a Generic Volume License Key (GVLK) installed, this prompts an attempt at KMS activation. Systems that have been set to suspend automatic KMS activation attempts (/stao) still attempt KMS activation when /ato is run. The parameter [Activation ID] expands /ato support to identify a Windows edition installed on the computer. Specifying the [Activation ID] parameter isolates the effects of the option to the edition associated with that Activation ID.
  • /dli [Activation ID | All] - Display license information. By default, /dli displays the license information for the installed active Windows edition. Specifying the [Activation ID] parameter displays the license information for the specified edition associated with that Activation ID. Specifying the [All] as the parameter will display all applicable installed products’ license information.
  • /dlv [Activation ID | All] - Display detailed license information. By default, /dlv displays the license information for the installed operating system. Specifying the [Activation ID] parameter displays the license information for the specified edition associated with that Activation ID. Specifying the [All] parameter displays all applicable installed products’ license information.
  • /xpr [Activation ID] - Display the activation expiration date for the product. By default, this refers to the current Windows edition and is primarily useful for KMS clients, because MAK and retail activation is perpetual. Specifying the [Activation ID] parameter displays the activation expiration date of the specified edition associated with that Activation ID.
Back to top

Advanced Options

  • /cpky - Removes the product key from the registry to prevent this key from being stolen by malicious code. For retail installations that deploy keys, best practices recommend running this option. This option is not required for MAK and KMS host keys, because this is the default behavior for those keys.
  • /ilc <license_file> - Installs the license file specified by the required parameter.
  • /rilc - Reinstalls all licenses stored in %SystemRoot%\system32\oem and %SystemRoot%\System32\spp\tokens. These are “known-good” copies stored during installation. Any matching licenses in the Trusted Store are replaced. Any additional licenses—for example, Trusted Authority (TA) Issuance Licenses (ILs), licenses for applications—are not touched.
  • /rearm - Resets the activation timers. The /rearm process is also called by sysprep /generalize. This operation will do nothing if the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\SkipRearm registry subkey is equal to 1.
  • /upk [ActivationID] - Uninstalls the product key of the current Windows edition. After a restart, the system will be in an Unlicensed state unless a new product key is installed. Optionally, you can use the [Activation ID] parameter to specify a different installed product.
Back to top

Volume Licensing: KMS Client Options

  • /skms Name[:Port] | : port [Activation ID] [Activation ID] - Specifies the name and, optionally, the port of the KMS host computer to contact. Setting this value disables auto-detection of the KMS host. If the KMS host uses Internet Protocol version 6 (IPv6) only, the address must be specified in the format [hostname]:port.
  • /ckms [Activation ID] - Removes the specified KMS host name, address, and port information from the registry and restores KMS auto-discovery behavior.
  • /skhc - Enables KMS host caching (default), which blocks the use of Domain Name System (DNS) priority and weight after the initial discovery of a working KMS host. If the system can no longer contact the working KMS host, discovery will be attempted again.
  • /ckhc - disables KMS host caching. This setting instructs the client to use DNS auto-discovery each time it attempts KMS activation (recommended when using priority and weight).

KMS Host Configuration

  • /sai <interval> - Sets the interval in minutes for unactivated clients to attempt KMS connection. The activation interval must be between 15 minutes and 30 days, although the default (2 hours) is recommended. The KMS client initially picks up this interval from registry but switches to the KMS setting after it receives the first KMS response.
  • /sri <interval> - Sets the renewal interval in minutes for activated clients to attempt KMS connection. The renewal interval must be between 15 minutes and 30 days. This option is set initially on both the KMS server and client sides. The default is 10080 minutes (7 days). The KMS client initially picks up this interval from the registry but switches to the KMS setting after it receives the first KMS response.
  • /sprt <port> - Sets the port on which the KMS host listens for client activation requests. The default TCP port is 1688.
  • /sdns - Enables DNS publishing by the KMS host (default).
  • /cdns - Disables DNS publishing by the KMS host.
  • /spri - Sets the KMS priority to normal (default).
  • /cpri - Sets the KMS priority to low. Use this option to minimize contention from KMS in a co-hosted environment. Note that this could lead to KMS starvation, depending on what other applications or server roles are active. Use with care.

Token-based Activation Configuration

  • /lil - List the installed token-based activation issuance licenses.
  • /ril <ILID> <ILvID> - Remove an installed token-based activation issuance license.
  • /stao - Set the Token-based Activation Only flag, disabling automatic KMS activation.
  • /ctao - Clear the Token-based Activation Only flag (default), enabling automatic KMS activation.
  • /ltc - List valid token-based activation certificates that can activate installed software.
  • /fta <Certificate Thumbprint> [PIN] - Force token-based activation using the identified certificate. The optional personal identification number (PIN) is provided to unlock the private key without a PIN prompt when using certificates that are protected by hardware (for example, smart cards).
Back to top



Other Languages

This article is also available in the following languages:

Italian (it-IT)