PowerShell OSLicense Guide: Check Activation, Install Keys, and Manage KMS
The PowerShell OSLicense module lets you check Windows activation status, install product keys, activate Windows, and manage KMS licensing without using the older slmgr.vbs commands.
Microsoft introduced the module for Windows 11 with the August 27, 2026 preview update (KB5120998) and later updates. It requires Windows PowerShell 5.1.
How to use the PowerShell OSLicense module
1. Check if OSLicense is available
- Open Start, search for Windows PowerShell, and select Run as administrator.
- Run the following command:
Get-Module -ListAvailable -Name OSLicense - If PowerShell finds the module, run:
Import-Module OSLicense - List its available commands:
Get-Command -Module OSLicense
If the module doesn’t appear, install the latest supported Windows updates and try again.
If PowerShell blocks the module because of execution policy restrictions, follow our guide to fix the execution of scripts is disabled on this system error.
2. Check Windows activation status
Run:
Get-OSLicenseInfo
The command displays Windows licensing information, including the activation status and product key details.
To check specific information, run:
Get-OSLicenseInfo | Select-Object Name, LicenseStatus, PartialProductKey, GracePeriodRemaining, EvaluationEndDate
To list all licensing products:
Get-OSLicenseInfo -All
These commands replace common licensing checks previously performed through slmgr.vbs /dlv.
You can also export licensing information to a CSV file for troubleshooting or recordkeeping. If Windows prevents you from saving the file, see how to fix PowerShell Export-CSV access to the path is denied.
3. Install a Windows product key
Run the following command with your valid Windows product key:
Invoke-OSLicense -InstallProductKey “XXXXX-XXXXX-XXXXX-XXXXX-XXXXX”
Replace the placeholder with your actual 25-character key.
Check whether Windows accepted the key:
Get-OSLicenseInfo
Installing a product key does not necessarily activate Windows.
4. Activate Windows using PowerShell
Ensure your computer has an internet connection, then run:
Invoke-OSLicense -ActivateOnline
Check the activation status:
Get-OSLicenseInfo
To inspect any activation errors, use:
$result = Invoke-OSLicense -ActivateOnline
$result | Select-Object Success, ErrorCode, ErrorMessage
A Success value of True indicates that the operation succeeded.
5. Check and configure KMS activation
For organizations using Key Management Services, check the current configuration:
Get-KmsLicenseInfo
To configure your organization’s KMS server:
Set-KmsLicenseInfo -ServerName “kms.example.com” -Port 1688
Replace the example hostname with your authorized KMS server.
To activate Windows using the configured licensing infrastructure:
Invoke-OSLicense -ActivateOnline
These commands help administrators manage Windows volume activation without relying on VBScript.
6. Fix OSLicense module not found
If PowerShell displays The term ‘Get-OSLicenseInfo’ is not recognized, follow these steps:
- Open Settings > Windows Update and install the latest available updates.
- Restart your computer.
- Open Windows PowerShell 5.1 as administrator.
- Run the following command:
Import-Module OSLicense
If the command fails, check whether your Windows version supports the module. On Windows Server, Microsoft currently documents support in Windows Server vNext Preview Build 29651 or later.
If Windows cannot recognize PowerShell itself, try these solutions for PowerShell not recognized before attempting to import the module again.
For additional commands and parameters, consult the official Microsoft OSLicense documentation.
PowerShell OSLicense simplifies Windows activation management by replacing several traditional slmgr.vbs operations with PowerShell commands. You can use it to check activation status, install product keys, activate Windows, and configure KMS licensing from one interface.
FAQ
What is the PowerShell OSLicense module?
The OSLicense module is a Windows PowerShell 5.1 module for checking activation status, installing product keys, activating Windows, and managing KMS licensing.
Which Windows versions support OSLicense?
Microsoft introduced OSLicense for Windows 11 with the August 27, 2026 preview update (KB5120998) and later updates. Microsoft also documents support for Windows Server vNext Preview Build 29651 or later.
Does installing a product key activate Windows?
No. Installing a product key adds the key to Windows, but activation is a separate step. After installing the key, run Invoke-OSLicense -ActivateOnline to attempt online activation.
What should I do if PowerShell cannot find OSLicense commands?
Install the latest supported Windows updates, restart the computer, open Windows PowerShell 5.1 as administrator, and run Import-Module OSLicense. If the module still cannot be imported, verify that your Windows version supports it.
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
User forum
0 messages