With Server 2012 going End of Life and requiring extended support on October 10th. I’m being asked ot generate a report from Rapid7 showing what systems have Extended support applied. I was thinking of doing this using a compliance policy and using a WMI query that would check the license status. I have the query working in powershell but am having trouble getting it working in the compliance policy
Powershell
(Get-WmiObject -Query (‘SELECT LicenseStatus FROM SoftwareLicensingProduct where PartialProductKey = “{0}”’ -f “GMXTD”)).LicenseStatus
Returns a value of 1 if the system is licensed
For the compliance policy I have the check built as a WMI test
Type - Wmi Test
Test Title - Extended support license is installed
Existence - All Exist
Check - All
Expected Result - Pass
Definition ID - def-5197
WMI Namespace - root\cimv2
Operator - equals
WQL Query - SELECT LicenseStatus FROM SoftwareLicensingProduct where PartialProductKey = “{0}”’ -f “GMXTD”
Operator - equals
Expected Result
Licensestatus - 1
Operator - equals