In this article, we will show how to make sure that your copy of Windows is activated on a computer and check Windows activation status from all computers in your Active Directory domain network using PowerShell.
How to check if Windows is activated?
First, let’s see how to check Windows activation status on your computer. You can check Windows activation status using the Settings app (in modern Windows 10 and Windows 11 builds).
- On Windows 10 and Windows Server 2022/2019/2016, go here Adjustment -> Update & Security , activation (or run
ms-settings:activation
URI command to quickly access ms-settings) - In Windows 11, open Adjustment , Management , activation
You may see one of the following activation conditions:
Windows is activated using your organization’s activation service
– This means that your copy of Windows is activated on the corporate KMS server (FAQ on KMS Activation);Windows is activated with a digital license
– Your copy of Windows has been activated using a digital license that is not linked to a Microsoft user account;Windows is activated with a digital license linked to your Microsoft account
Not Activated – Windows reported that no product key was found on your device. Error code: 0xC004F214
– Windows is installed without a product key and is not activated.
You can get Windows Activation from the Command Prompt. To do this, use SLMgr.vbs Script, which allows the management of Windows licenses and activations. Run Command Prompt (cmd) as an administrator and enter the command below:
slmgr /xpr
A window in a few seconds”The machine is permanently activated
“The message appears.
If Windows is not activated, you will see the message: Windows is in Notification mode
,
cscript slmgr.vbs -xpr
Check Windows Activation Using PowerShell
You can use PowerShell to get Windows activation information on a local or remote computer. Run the following command to receive data from CIM (WMI):
Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | where { $_.PartialProductKey } | select Description, LicenseStatus
Possible license status values:
- 0 – unlicensed
- 1 – License
- 2 – OOBGRES
- 3 – OOTGrace – The computer configuration has changed, and cannot be activated automatically, or more than 180 days have passed
- 4 – non real grace
- 5 – notification – windows trial period has expired
- 6 – ExtendedGrace (you can extend the Windows evaluation period several times by using
slmgr /rearm
Order or convert evaluation to full version)
The screenshot below shows that LicenseStatus = 1
, This means that Windows is activated using a retail product key (Windows(R) Operating System, Retail Channel,
To get the activation status of a remote computer, specify its name -computer name Parameters:
Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" -ComputerName mun-srv03 |where { $_.PartialProductKey } | select Description, LicenseStatus
VOLUME_KMSCLIENT channel
The string means that the computer is active on the KMS server.
Get Windows Activation Status on an AD Computer with PowerShell
You can use PowerShell to remotely obtain the activation status of Windows desktop computers and Windows Server hosts in Active Directory domains. You can see an example script below.
To get a list of computers in a domain, the Get-ADComputer cmdlet from the Active Directory for PowerShell module is used. This powershell script checks the availability of each computer in Active Directory (a simple ICMP ping using test-netconnection), a build and version of the OS installed on them, and gets the Windows activation status.
enum Licensestatus{
Unlicensed = 0
Licensed = 1
Out_Of_Box_Grace_Period = 2
Out_Of_Tolerance_Grace_Period = 3
Non_Genuine_Grace_Period = 4
Notification = 5
Extended_Grace = 6
}
$Report = @()
$ADComps = Get-ADComputer -Filter {enabled -eq "true" -and OperatingSystem -Like '*Windows*'}
Foreach ($comp in $ADComps) {
If ((Test-NetConnection $comp.name -WarningAction SilentlyContinue).PingSucceeded -eq $true){
$activation_status= Get-CimInstance -ClassName SoftwareLicensingProduct -ComputerName $comp.name -Filter "Name like 'Windows%'" |where { $_.PartialProductKey } | select PSComputerName, @{N=’LicenseStatus’; E={[LicenseStatus]$_.LicenseStatus}}
$windowsversion= Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $comp.name| select Caption, Version
$objReport = [PSCustomObject]@{
ComputerName = $activation_status.PSComputerName
LicenseStatus= $activation_status.LicenseStatus
Version = $windowsversion.caption
Build = $windowsversion.Version
}
}
else {
$objReport = [PSCustomObject]@{
ComputerName = $comp.name
LicenseStatus = "Computer offline"
}
}
$Report += $objReport
}
$Report |Out-GridView
Information about Windows activation status on domain computers is shown as an out-grid view table. Or you can export it to a CSV file (Export-Csv -Path .\ad_windows_activation_report.csv -NoTypeInformation
,
That way, you can quickly find all non-activated (unlicensed) copies of Windows on computers in your domain.
Leave a Comment