Recently, one of my clients in New York asked me about getting the Windows activation status of a small office network. You can get it using PowerShell. In this tutorial, I will explain how to get Windows activation status using PowerShell.
Note: Make sure you have the administrator access to the systems you want to check.
Let’s get started.
Get Windows Activation Status Using PowerShell Using WMI
Windows Management Instrumentation (WMI) provides a standardized way to interact with system components. To check the activation status of a Windows machine, we will query the SoftwareLicensingProduct class.
Here is a simple PowerShell script to get the activation status:
$wmiObject = Get-WmiObject -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND LicenseFamily <> null"
foreach ($item in $wmiObject) {
if ($item.ApplicationID -eq "55c92734-d682-4d71-983e-d6ec3f16059f") {
Write-Output "Product Name: $($item.Name)"
Write-Output "License Status: $($item.LicenseStatus)"
Write-Output "Partial Product Key: $($item.PartialProductKey)"
}
}Output
It would help if you now understood the output.
The script above retrieves the activation status of Windows installations. The LicenseStatus property can have the following values:
0: Unlicensed1: Licensed2: Initial Grace Period3: Additional Grace Period4: Non-Genuine Grace Period5: Notification6: Extended Grace Period
For example, if you run this script on a workstation in your Los Angeles office, you might see an output like this:
Product Name: Windows(R), Professional edition
License Status: 1
Partial Product Key: ABCDEThis indicates that the Professional Edition of Windows is licensed and activated.
I executed the above PowerShell script, and you can see the exact output in the screenshot below:

Check out How to List Printers Using PowerShell?
Get Windows Activation Status for Multiple Machines
If you manage multiple machines, manually checking each one can be time-consuming. PowerShell can help automate this process. Below is a script that checks the activation status of multiple remote computers:
$computers = @("NYC-PC01", "LA-PC02", "CHI-PC03") # Add your computer names here
foreach ($computer in $computers) {
try {
$wmiObject = Get-WmiObject -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND LicenseFamily <> null" -ComputerName $computer
foreach ($item in $wmiObject) {
if ($item.ApplicationID -eq "55c92734-d682-4d71-983e-d6ec3f16059f") {
Write-Output "Computer: $computer"
Write-Output "Product Name: $($item.Name)"
Write-Output "License Status: $($item.LicenseStatus)"
Write-Output "Partial Product Key: $($item.PartialProductKey)"
Write-Output "------------------------------"
}
}
} catch {
Write-Output "Failed to connect to $computer"
}
}The script includes a try-catch block to handle any errors that might occur when connecting to remote computers. This ensures that the script continues running even if it encounters an essential issue with one of the machines.
Check out Get a List of Installed Programs Using PowerShell
Download Windows Activation Status Report using CSV
For larger environments, you might want to export the results to a CSV file for easier analysis. Here’s how to modify the script to save the output to a CSV file:
$computers = @("NYC-PC01", "LA-PC02", "CHI-PC03") # Add your computer names here
$results = @()
foreach ($computer in $computers) {
try {
$wmiObject = Get-WmiObject -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND LicenseFamily <> null" -ComputerName $computer
foreach ($item in $wmiObject) {
if ($item.ApplicationID -eq "55c92734-d682-4d71-983e-d6ec3f16059f") {
$results += [PSCustomObject]@{
ComputerName = $computer
ProductName = $item.Name
LicenseStatus = $item.LicenseStatus
PartialProductKey = $item.PartialProductKey
}
}
}
} catch {
$results += [PSCustomObject]@{
ComputerName = $computer
ProductName = "N/A"
LicenseStatus = "Failed to connect"
PartialProductKey = "N/A"
}
}
}
$results | Export-Csv -Path "C:\ActivationStatusReport.csv" -NoTypeInformationThis script collects the activation status from multiple computers and saves the results to a CSV file named ActivationStatusReport.csv.
Conclusion
In this tutorial, I explained how to get Windows activation status using PowerShell; I ran it, and you saw the exact status. Using the complete PowerShell script, I have also shown how to find Windows activation status for multiple machines. Do let me know in the comment below if this works for you.
You may also like the following tutorials:
- List All Environment Variables in PowerShell
- List USB Devices Using PowerShell
- List Local Administrators Using PowerShell
- How to Retrieve Your Windows Product Key Using PowerShell?
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.