Set-KmsLicenseInfo
Sets the Key Management Services (KMS) license configuration.
Syntax
__AllParameterSets
Set-KmsLicenseInfo
[[-ServerName] <String>]
[[-Port] <Int32>]
[[-Domain] <String>]
[[-ActivationInterval] <Int32>]
[[-RenewalInterval] <Int32>]
[[-ListeningPort] <Int32>]
[[-Priority] <String>]
[[-DnsPublishing] <Boolean>]
[[-HostCaching] <Boolean>]
[-AsJob]
Description
The Set-KmsLicenseInfo cmdlet changes Key Management Services (KMS) client and host settings on
the local computer. Specify only the settings that you want to change. Settings for omitted
parameters remain unchanged.
The cmdlet returns a structured object that indicates whether the operation succeeded. When an operation fails, the cmdlet includes the available Windows error code and error message in the object instead of writing an error to the console.
Note
Set-KmsLicenseInfo is available in Windows Server vNext Preview Build 29651
and the 2026-09 security update for Windows 11 (KB5124008).
Examples
Example 1: Configure a specific KMS host
This command configures the local KMS client to contact the fictitious host kms01.example.com on
TCP port 1688. Setting a specific host disables KMS host autodiscovery. This command changes the
local computer's licensing configuration, so confirm the host name and port before you run it.
Set-KmsLicenseInfo -ServerName 'kms01.example.com' -Port 1688
The command returns an object with a Success property that indicates whether the licensing service applied the configuration.
Example 2: Configure KMS host behavior
This command configures a KMS host to publish its DNS record, use normal priority, and listen on TCP
port 1688. It also provides activation and renewal intervals to clients. The interval values are
in minutes.
Changing these settings can affect KMS discovery and activation across the environment, so review
the values before you run the command.
$kmsConfiguration = @{
DnsPublishing = $true
Priority = 'Normal'
ListeningPort = 1688
ActivationInterval = 120
RenewalInterval = 10080
}
Set-KmsLicenseInfo @kmsConfiguration
The KMS default activation interval is 120 minutes, and the default renewal interval is 10080
minutes (seven days).
Parameters
-ActivationInterval
Specifies, in minutes, how often unactivated KMS clients try to connect to a KMS host. KMS supports
values from 15 through 43200 minutes (30 days), and the default is 120 minutes (two hours).
The cmdlet doesn't define a range-validation attribute for this parameter. The licensing service validates the value and returns failure details in the result object when it rejects a value. If you omit this parameter, the current setting remains unchanged.
Parameter properties
| Type: | Int32 |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 3 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-AsJob
Runs the command as a background job. The command returns a job object that you can use with the PowerShell job cmdlets. The implicit remoting proxy provides this parameter.
Parameter properties
| Type: | SwitchParameter |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-DnsPublishing
Specifies whether the KMS host publishes its service resource (SRV) record in Domain Name System
(DNS). Specify $true to enable publishing or $false to disable it. By default, a KMS host
publishes its SRV record in DNS. If you omit this parameter, the current setting remains unchanged.
Parameter properties
| Type: | Boolean |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 7 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Domain
Specifies the DNS domain in which the KMS client searches for KMS SRV records. This setting has no effect when you configure a specific KMS host with ServerName. If you omit this parameter, the current setting remains unchanged.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 2 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-HostCaching
Specifies whether a KMS client caches a discovered KMS host. Specify $true to enable caching or
$false to disable it. The KMS client enables host caching by default. If you omit this parameter,
the current setting remains unchanged.
Parameter properties
| Type: | Boolean |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 8 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-ListeningPort
Specifies the TCP port on which a KMS host listens for client activation requests. The KMS default
listening port is 1688. The cmdlet doesn't define a range-validation attribute for this parameter;
the licensing service validates the value. If you omit this parameter, the current setting remains
unchanged.
Parameter properties
| Type: | Int32 |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 5 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Port
Specifies the TCP port that the KMS client uses to contact the KMS host that ServerName
specifies. The KMS default port is 1688. The cmdlet doesn't define a range-validation attribute
for this parameter; the licensing service validates the value. If you omit this parameter, the
current setting remains unchanged.
Parameter properties
| Type: | Int32 |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 1 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Priority
Specifies the process priority for the KMS host. The default is Normal. Use Low with care
because other active applications or server roles can prevent a low-priority KMS host from
responding in a timely manner. If you omit this parameter, the current setting remains unchanged.
Parameter properties
| Type: | String |
| Accepted values: | Normal, Low |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 6 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-RenewalInterval
Specifies, in minutes, how often activated KMS clients try to renew their activation. KMS supports
values from 15 through 43200 minutes (30 days), and the default is 10080 minutes (seven days).
The cmdlet doesn't define a range-validation attribute for this parameter. The licensing service validates the value and returns failure details in the result object when it rejects a value. If you omit this parameter, the current setting remains unchanged.
Parameter properties
| Type: | Int32 |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 4 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-ServerName
Specifies the host name of the KMS host that the client contacts. Configuring a specific KMS host disables KMS host autodiscovery. If you omit this parameter, the current setting remains unchanged.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 0 |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
Inputs
None
This cmdlet doesn't accept input from the pipeline.
Outputs
PSCustomObject
When you run the cmdlet synchronously, it returns a structured result object. A successful result
contains Success set to $true. A failed result contains Success set to $false, an
ErrorCode value formatted as a hexadecimal Windows error code when one is available, and an
ErrorMessage value. The cmdlet can return $null if it can't obtain the licensing service.
Job
When you use AsJob, the implicit remoting proxy returns a job object that contains the command result.
Notes
This cmdlet changes persistent KMS configuration on the local computer. Run it from an elevated
PowerShell session. Before changing settings, record the current configuration with
Get-KmsLicenseInfo so that you can restore it if necessary.
All configuration parameters are optional, and the cmdlet changes only parameters that you
specify. The integer parameters don't have ValidateRange attributes. Priority is the only
parameter with explicit value validation and accepts Normal or Low.
The source function doesn't define an AsJob parameter. The published command surface retains AsJob because its implicit remoting proxy adds the parameter.