This is an example of how to determine a Microsoft Windows license activation status using a simple Powershell to call into the WMI SoftwareLicensingProduct object.

function Get-ActivationStatus {
 [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
 [string]$DNSHostName = $Env:COMPUTERNAME
 process {
 try {
 $wpa = Get-WmiObject SoftwareLicensingProduct -ComputerName $DNSHostName `
 -Filter "ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f'" `
 -Property LicenseStatus -ErrorAction Stop
 } catch {
 $status = New-Object ComponentModel.Win32Exception ($_.Exception.ErrorCode)
 $wpa = $null 
 $out = New-Object psobject -Property @{
 ComputerName = $DNSHostName;
 Status = [string]::Empty;
 if ($wpa) {
 :outer foreach($item in $wpa) {
 switch ($item.LicenseStatus) {
 0 {$out.Status = "Unlicensed"}
 1 {$out.Status = "Licensed"; break outer}
 2 {$out.Status = "Out-Of-Box Grace Period"; break outer}
 3 {$out.Status = "Out-Of-Tolerance Grace Period"; break outer}
 4 {$out.Status = "Non-Genuine Grace Period"; break outer}
 5 {$out.Status = "Notification"; break outer}
 6 {$out.Status = "Extended Grace"; break outer}
 default {$out.Status = "Unknown value"}
 } else { $out.Status = $status.Message }

This function is designed to be compatible with Get-ADComputer cmdlet. You can pipe cmdlet output to a function. For example, if you want to get activation status for all computers in the domain, you can use the following command sequence:

Get-ADComputer -Filter * | Get-ActivationStatus

and here is example output:

PS C:\> Get-ADComputer -Filter * | Get-ActivationStatus
ComputerName                    Status
------------                    ------
Server                          Licensed
TestPC1                                                  Licensed
TestPC2  The RPC server is unavailable
TestPC3  Licensed
TestPC4  Unlicensed
PS C:\>

The RPC server is unavailable status means that WMI call was unsuccessful (for example, remote computer is offline or unreachable due to network connectivity or firewall issues).

Enterprise customers may use Volume Activation Management Tool 2.0.