Get-OSLicenseInfo
Gets Windows operating system licensing information.
Syntax
Default
Get-OSLicenseInfo
[-AsJob]
All
Get-OSLicenseInfo
[-All]
[-AsJob]
ActivationID
Get-OSLicenseInfo
[-ActivationID <String>]
[-AsJob]
TokenLicenses
Get-OSLicenseInfo
[-TokenBasedLicenses]
[-AsJob]
TokenCertificates
Get-OSLicenseInfo
[-TokenBasedCertificates]
[-AsJob]
Description
The Get-OSLicenseInfo cmdlet queries local software licensing Common Information Model
(CIM) classes to return structured licensing information.
Without parameters, the cmdlet returns the first Windows
operating system product that has a partial product key and isn't an add-on license.
Use ActivationID to query a specific product, All to query every product that has an application ID and name, or the token parameters to query token-based licenses or certificates.
Note
Get-OSLicenseInfo is available in Windows Server vNext Preview Build 29651
and the 2026-09 security update for Windows 11 (KB5124008).
Examples
Example 1: Get the primary Windows license status
Get-OSLicenseInfo |
Select-Object Name, ActivationID, LicenseStatus, PartialProductKey,
GracePeriodRemaining, EvaluationEndDate
This example gets the primary Windows operating system license and selects properties that show its activation state and expiration.
Example 2: Review token-based licenses
Get-OSLicenseInfo -TokenBasedLicenses |
Sort-Object ExpirationDate |
Select-Object ILID, ILvID, AuthorizationStatus, Description, ExpirationDate
This example sorts token-based licenses by expiration date and selects their identifying and status properties.
Parameters
-ActivationID
Specifies the activation ID of the software licensing product that the cmdlet returns. The cmdlet performs an exact match against the ID property of the SoftwareLicensingProduct CIM instance.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
ActivationID
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-All
Returns every software licensing product whose ApplicationID and Name properties contain values. The results can include products other than the primary Windows operating system license.
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 |
-AsJob
Runs the command as a background job when you invoke it through an implicit-remoting wrapper. This
wrapper supplies the parameter, and the local OSLicense module function doesn't declare it.
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 |
-TokenBasedCertificates
Returns token-based activation certificate information from the local software licensing service, including the issued certificate thumbprint list, grant number, ILID, and ILvID.
Parameter properties
| Type: | SwitchParameter |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
TokenCertificates
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-TokenBasedLicenses
Returns installed token-based activation licenses. Each result includes the ILID, ILvID, authorization status, description, and expiration date.
Parameter properties
| Type: | SwitchParameter |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
TokenLicenses
| Position: | Named |
| 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 pipeline input.
Outputs
PSCustomObject
For the default, All, and ActivationID parameter sets, the cmdlet returns objects that
combine product and licensing-service data. Notable properties include Name, ActivationID,
ApplicationID, PartialProductKey, LicenseStatus, LicenseStatusReason,
GracePeriodRemaining, EvaluationEndDate, OfflineInstallationId, rearm counts,
Version, ClientMachineID, and IsKeyManagementServiceMachine. Objects include Key Management
Service (KMS) properties such as KeyManagementServiceMachine, KeyManagementServicePort, and
activation and renewal intervals only when KMS configuration or discovery data exists.
For TokenBasedLicenses, each object has ILID, ILvID, AuthorizationStatus, Description, and ExpirationDate properties. For TokenBasedCertificates, the object has TokenBasedActivationCertificateIssuedList, TokenBasedActivationGrantNumber, TokenBasedActivationILID, TokenBasedActivationILVID, and TokenBasedActivationAdditionalInfo properties.
Job
When you use AsJob through an implicit-remoting wrapper, the cmdlet returns a job object. Use
Receive-Job to retrieve the licensing objects from the completed job.
Notes
The cmdlet returns no object when it finds no matching licensing data or when its CIM query fails.
It returns unset date values as $null. It also converts licensing sentinel values to contextual
strings such as Unlimited, No Limit, N/A, or Not Set where applicable.
The LicenseStatus value is a localized status string. The cmdlet formats LicenseStatusReason as
a hexadecimal error code when the source value isn't $null.