Detecting ESU product

Detecting ESU product

Postby aker » 02.11.2020, 23:33

To be able to create a warning, if an ESU license is required, I tried to create a script, which works similar to slmgr.vbs to query the ESU-licenses. The question is, which licensing status allow the installation of ESU-updates and which do not.
The idea I have would check the signing date of wsusscn2.cab and the licensing status ESU licenses, if it seems to be an invalid combo, it should show a warning or refuse to do the dynamic search.

"Unlicensed" -> most likely not
"Licensed" -> most likely
"OOBGrace" -> ???
"OOTGrace" -> ???
"NonGenuineGrace" -> ???
"Notification" -> most likely not
"Unknown" -> most likely not

Is there someone out there, who is able to test it?
To get the licensing status for an ID, just run
Code: Select all
cscript WindowsLicensingDemoScript.vbs <activation ID>

from an administrative command prompt and replace "<activation ID>" with the activation id from the next post.
I'll post the IDs required to query the licenses in the next post.

The script (WindowsLicensingDemoScript.vbs):
Code: Select all
Option Explicit

private const LicenseStatus_Unlicensed   =   0
private const LicenseStatus_Licensed   =   1
private const LicenseStatus_OOBGrace   =   2
private const LicenseStatus_OOTGrace   =   3
private const LicenseStatus_NonGenuineGrace   =   4
private const LicenseStatus_Notification   =   5
private const LicenseStatus_ExtendedGrace   =   6

Dim objWMIService, objQueryItem, strQueryClause

strQueryClause = "Select ID, Name, PartialProductKey, LicenseStatus, LicenseStatusReason from SoftwareLicensingProduct"
If WScript.Arguments.Count >= 1 Then
  strQueryClause = strQueryClause & " Where ID = '" & WScript.Arguments(0) & "'"
Else
  strQueryClause = strQueryClause & " Where PartialProductKey <> null"
End If

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
' Documentation: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/sppwmi/softwarelicensingproduct
For Each objQueryItem in objWMIService.ExecQuery(strQueryClause)
  WScript.Echo "ID:                   " & objQueryItem.ID
  WScript.Echo "Name:                 " & objQueryItem.Name
  'WScript.Echo "PartialProductKey:    " & objQueryItem.PartialProductKey
  WScript.Echo "LicenseStatus:        " & objQueryItem.LicenseStatus
  WScript.Echo "LicenseStatusReason:  " & objQueryItem.LicenseStatusReason
  If (objQueryItem.LicenseStatus = LicenseStatus_Unlicensed) Then ' Unlicensed
    WScript.Echo "                      Unlicensed"
  ElseIf (objQueryItem.LicenseStatus = LicenseStatus_Licensed) Then ' Licensed
    WScript.Echo "                      Licensed"
  ElseIf (objQueryItem.LicenseStatus = LicenseStatus_OOBGrace) Then ' OOBGrace
    WScript.Echo "                      OOBGrace"
  ElseIf (objQueryItem.LicenseStatus = LicenseStatus_OOTGrace) Then ' OOTGrace
    WScript.Echo "                      OOTGrace"
  ElseIf (objQueryItem.LicenseStatus = LicenseStatus_NonGenuineGrace) Then ' NonGenuineGrace
    WScript.Echo "                      NonGenuineGrace"
  ElseIf (objQueryItem.LicenseStatus = LicenseStatus_Notification) Then ' Notification
    WScript.Echo "                      Notification"
  ElseIf (objQueryItem.LicenseStatus = LicenseStatus_ExtendedGrace) Then ' ExtendedGrace
    WScript.Echo "                      ExtendedGrace"
  Else
    WScript.Echo "                      Unknown"
  End If
  WScript.Echo ""
Next
WScript.Quit(0)

Last edited by aker on 02.11.2020, 23:57, edited 3 times in total.
Reason: Don't display PartialProductKey
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.3.1 / 11.9.6esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3707
Joined: 02.03.2011, 15:32

Re: Detecting ESU product

Postby aker » 02.11.2020, 23:33

ESU Activation IDs for w60:
Name: Windows Server(R), Server-ESU-Year1 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_KMSCLIENT channel
Activation ID: 130ab21f-ca91-4aae-b67f-ac3b45534731

Name: Windows Server(R), Server-FES-ESU-Year1 add-on for ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 3ca9443e-6f68-4747-bb5e-7f0fbbd55ef0

Name: Windows Server(R), Server-ESU-Year1 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 553673ed-6ddf-419c-a153-b760283472fd



Name: Windows Server(R), Server-ESU-Year2 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_KMSCLIENT channel
Activation ID: a7e6fb3c-cb11-4832-bab0-deee887af138

Name: Windows Server(R), Server-ESU-Year2 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 04fa0286-fa74-401e-bbe9-fbfbb158010d

Name: Windows Server(R), Server-FES-ESU-Year2 add-on for ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 66c3d302-3a0e-4fca-9558-5a185996e592



Name: Windows Server(R), Server-ESU-Year3 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_KMSCLIENT channel
Activation ID: 151db6a5-3dfa-4c7f-b5ba-af8d7991adc9

Name: Windows Server(R), Server-ESU-Year3 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 16c08c85-0c8b-4009-9b2b-f1f7319e45f9

Name: Windows Server(R), Server-FES-ESU-Year3 add-on for ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: c5958cad-5b44-4780-8a6c-aa0d7033d261



Name: Windows(TM) Vista, Server-ESU-PA add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Vista, VOLUME_KMSCLIENT channel
Activation ID: d9205746-5f80-4062-ab75-eda24319d0fc

Name: Windows(TM) Vista, Server-ESU-PA add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Vista, VOLUME_MAK channel
Activation ID: 8e7bfb1e-acc1-4f56-abae-b80fce56cd4b


ESU Activation IDs for w61:
Name: Windows(R) 7, Client-ESU-Year1 add-on for Enterprise,EnterpriseE,EnterpriseN,Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_KMSCLIENT channel
Activation ID: 3fcc2df2-f625-428d-909a-1f76efc849b6

Name: Windows(R) 7, Client-ESU-Year1 add-on for Enterprise,EnterpriseE,EnterpriseN,Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_MAK channel
Activation ID: 77db037b-95c3-48d7-a3ab-a9c6d41093e0

Name: Windows(R) 7, Client-FES-ESU-Year1 add-on for Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_MAK channel
Activation ID: a19fb49b-85ee-4681-bb06-465cae0c5cb4



Name: Windows(R) 7, Client-ESU-Year2 add-on for Enterprise,EnterpriseE,EnterpriseN,Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_KMSCLIENT channel
Activation ID: dadfcd24-6e37-47be-8f7f-4ceda614cece

Name: Windows(R) 7, Client-ESU-Year2 add-on for Enterprise,EnterpriseE,EnterpriseN,Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_MAK channel
Activation ID: 0e00c25d-8795-4fb7-9572-3803d91b6880

Name: Windows(R) 7, Client-FES-ESU-Year2 add-on for Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_MAK channel
Activation ID: a8c83d22-513d-43ee-bf72-02ca8fa42452



Name: Windows(R) 7, Client-ESU-Year3 add-on for Enterprise,EnterpriseE,EnterpriseN,Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_KMSCLIENT channel
Activation ID: 0c29c85e-12d7-4af8-8e4d-ca1e424c480c

Name: Windows(R) 7, Client-ESU-Year3 add-on for Enterprise,EnterpriseE,EnterpriseN,Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_MAK channel
Activation ID: 4220f546-f522-46df-8202-4d07afd26454

Name: Windows(R) 7, Client-FES-ESU-Year3 add-on for Professional,ProfessionalE,ProfessionalN,Ultimate,UltimateE,UltimateN
Description: Windows Operating System - Windows(R) 7, VOLUME_MAK channel
Activation ID: a0678a50-e4eb-40eb-9349-b734976fb08a
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.3.1 / 11.9.6esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3707
Joined: 02.03.2011, 15:32

Re: Detecting ESU product

Postby aker » 02.11.2020, 23:33

Reserviert
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.3.1 / 11.9.6esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3707
Joined: 02.03.2011, 15:32

Re: Detecting ESU product

Postby boco » 03.11.2020, 00:03

"OOBGrace" -> ??? = Out Of the Box Grace (the initial 30 days), not applicable.
"OOTGrace" -> ??? = Out Of Tolerance Grace (some grace time provided for systems with changed hardware), no idea if applicable. KMS activation running out of the 180 days fall back into this state before going Unlicensed.
"NonGenuineGrace" -> ??? = Systems failing the WAT or online check.

Unused licenses are in Licensing state 0.


Quick check for all licensing options on the OS:
Code: Select all
cscript.exe /nologo c:\windows\system32\slmgr.vbs /dlv all


w60 ESU IDs

Name: Windows Server(R), Server-ESU-Year1 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_KMSCLIENT channel
Activation ID: 130ab21f-ca91-4aae-b67f-ac3b45534731

Name: Windows Server(R), Server-ESU-Year1 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 553673ed-6ddf-419c-a153-b760283472fd

Name: Windows Server(R), Server-FES-ESU-Year1 add-on for ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 3ca9443e-6f68-4747-bb5e-7f0fbbd55ef0

Name: Windows Server(R), Server-ESU-Year2 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_KMSCLIENT channel
Activation ID: a7e6fb3c-cb11-4832-bab0-deee887af138

Software licensing service version: 6.0.6003.20903
Name: Windows Server(R), Server-ESU-Year2 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 04fa0286-fa74-401e-bbe9-fbfbb158010d

Name: Windows Server(R), Server-FES-ESU-Year2 add-on for ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 66c3d302-3a0e-4fca-9558-5a185996e592

Name: Windows Server(R), Server-ESU-Year3 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_KMSCLIENT channel
Activation ID: 151db6a5-3dfa-4c7f-b5ba-af8d7991adc9

Name: Windows Server(R), Server-ESU-Year3 add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: 16c08c85-0c8b-4009-9b2b-f1f7319e45f9

Name: Windows Server(R), Server-FES-ESU-Year3 add-on for ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Windows Server(R), VOLUME_MAK channel
Activation ID: c5958cad-5b44-4780-8a6c-aa0d7033d261

Name: Windows(TM) Vista, Server-ESU-PA add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Vista, VOLUME_MAK channel
Activation ID: 8e7bfb1e-acc1-4f56-abae-b80fce56cd4b

Name: Windows(TM) Vista, Server-ESU-PA add-on for ServerDatacenter,ServerDatacenterCore,ServerDatacenterV,ServerDatacenterVCore,ServerStandard,ServerStandardCore,ServerStandardV,ServerStandardVCore,ServerEnterprise,ServerEnterpriseCore,ServerEnterpriseV,ServerEnterpriseVCore
Description: Windows Operating System - Vista, VOLUME_KMSCLIENT channel
Activation ID: d9205746-5f80-4062-ab75-eda24319d0fc
Microsoft update catalog: http://catalog.update.microsoft.com/v7/site/
Windows Install media download: https://support.microsoft.com/en-us/help/15088/windows-create-installation-media
boco
 
Posts: 2332
Joined: 24.11.2009, 17:00
Location: Germany

Re: Detecting ESU product

Postby aker » 03.11.2020, 21:27

My solution would be to accept 2020-01 to 2021-01 updates, if a "licensed" ESU-Year1-license is found, and so on.
If one of the other states allows the installation of ESU updates, I'll add that to the code.
Wer Rechtschreibfehler findet, darf sie behalten oder an den Meistbietenden versteigern. / Everybody finding a misspelling is allowed to keep or sell it.
aker


WSUS Offline Update „Community Edition“ 12.3.1 / 11.9.6esr
https://gitlab.com/wsusoffline
aker
 
Posts: 3707
Joined: 02.03.2011, 15:32


Return to Installation / Updating

Who is online

Users browsing this forum: No registered users and 22 guests