Examples for Windows 2008
string value of select "OfflineInstallationId from SoftwareLicensingProduct WHERE (PartialProductKey is not null) and (Name LIKE 'Windows(R)%25' or Name LIKE 'Windows Server(R)%25') and (Name LIKE '%25ESU-Year1%25')" of wmi | "No ESU License"
string value of select "OfflineInstallationId from SoftwareLicensingProduct WHERE (PartialProductKey is not null) and (Name LIKE 'Windows(R)%25' or Name LIKE 'Windows Server(R)%25') and (Name LIKE '%25ESU-Year2%25')" of wmi | "No ESU License"
string value of select "OfflineInstallationId from SoftwareLicensingProduct WHERE (PartialProductKey is not null) and (Name LIKE 'Windows(R)%25' or Name LIKE 'Windows Server(R)%25') and (Name LIKE '%25ESU-Year3%25')" of wmi | "No ESU License"
This will confirm if there is a Year 1, Year 2 or Year 3 ESU