Windows License Status
Summary
This monitor will identify computers where the license key is reported as inactivated or in a grace period.
Monitor
- 
Go to Alert Management>Monitors>Add monitor
 
- 
Click the Create Monitorbutton.
 
- 
This screen will appear. 
  
- 
Name: Windows License Status 
 Description: The monitor will detect computers with expired Windows license keys.
 Type: Script
 Family: Critical Impact Alerts
 Severity: Desktop Operating System
  
- 
The Conditionstab will start looking like this:
  
- 
Set the Repeat everyto 24 Hours:
 
- 
Disable the Ticket Resolutionsection by clicking theAutomatically resolvebutton.
  
- 
The Conditionssection will change to this:
  
- 
Paste this PowerShell script in the Scriptbox.$ErrorActionPreference = 'SilentlyContinue';
 (Get-CimInstance -Class SoftwareLicensingProduct -Filter "Name LIKE 'Windows%'" |
 Where-Object { $_.PartialProductKey } |
 Select-Object @{
 label = 'LStatus';
 expression = {
 switch ($_.LicenseStatus) {
 0 { 'Unlicensed' }
 1 { 'Licensed' }
 2 { 'OOBGrace' }
 3 { 'OOTGrace' }
 4 { 'NonGenuineGrace' }
 5 { 'Notification' }
 6 { 'ExtendedGrace' }
 }
 }
 }).LStatus 
- 
Change the comparator to ORfromAND
 
 
- 
Set UnlicensedandNonGenuineGraceto theScript Outputbox.
 
- 
Enable the Escalate ticket on script failure.
 
- 
Select the required client to target from the Select Targetsbutton.
 
 
- 
Final look: 
  
- 
Click the Savebutton to save the monitor set.