Warning: It’s pretty slow
(selects "LicenseStatus from SoftwareLicensingProduct WHERE ((PartialProductKey is not null) and (Name like '%25Client-ESU%25'))" of wmi)
Expected results are:
- Empty - If the license has not been entered
- LicenseStatus=0 - If the license has been entered and not activated
- LicenseStatus=1 - If the license has been entered and activated
- Error - Windows XP machines
EDIT: First version didn’t check that the ESU license was actually activated, just that it was entered.