Capturing Windows OS license information

Sławomir Baszton 0 Reputation points
2023-05-09T11:52:27.03+00:00

Hello.

Currently I'm supporting a client that uses different OS activation methods. In one Operating Company they use AD activation which seems to be problematic from the reporting standpoint as the usual way of capturing the license information from enduser machines seems to return incorrect data.

The way of capturing activated OS license that was used so far is grabbing info from WMI:

LicenseFamily from SoftwareLicensingProduct WHERE (PartialProductKey is not NULL) AND (ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f')

The problem is that after executing the script that is responsible for OS activation the above query returns expected "Enterprise" license BUT the next day the returned info shows again "Professional" while the following WMI query:

caption from Win32_OperatingSystem

returns "Microsoft Windows 10 Enterprise" on majority of such machines after the activation.

Normally I could extract the part after "Microsoft Windows 10" from it BUT for some Chinese machines the returned value consists of Chinese characters which makes this approach quite useless.

I've attempted some other ways of extracting the license information from machines and here are the ones I've tried:

  • grabbing the info from WMI but from different object:
OperatingSystemSKU from Win32_OperatingSystem

The data comes from the same “Win32_OperatingSystem” table as in previous point so presumably it should return similar details as the previous query (“caption from Win32_OperatingSystem”) but.. it’s not, as on some machines the returned “Caption” is “Microsoft Windows 10 Pro” while “OperatingSystemSKU” shows “Enterprise Edition” – this is the case also when the returned Caption is “Microsoft Windows 10 Enterprise” as on some machines, with that returned value, the OperatingSystemSKU shows “Windows Professional”.

  • retrieving the info from registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID

and:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CompositionEditionID

and there is discrepancy not only between the returned values from those two keys but also between those keys and other already mentioned methods.

The question is:

What is the best way of obtaining the information on which license is active on a machine? Is there a method that is universal and hence will return adequate and proper data regardless of activation method?

If such method exists then it’s preferable that it relies on obtaining data from WMI or Registry as this is used in automated way and we can directly extract information from WMI and Registry (and from some text files) unless it’s not possible to capture reliable and accurate data from any of those sources – in such case I’d like to know the proper alternative.

Answers mentioning clicking through windows are not what is asked here and won’t solve the issue of automatic Windows OS license reporting.

Regards.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,987 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,670 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. abbodi86 3,866 Reputation points
    2023-05-10T01:55:28.2433333+00:00

    There is a way through WMI, but it's a call method not query

    wmic path SoftwareLicensingProduct where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND PartialProductKey IS NOT NULL" call GetPolicyInformationDWord "Kernel-BrandingInfo"
    
    wmic path SoftwareLicensingProduct where "ApplicationID='55c92734-d682-4d71-983e-d6ec3f16059f' AND PartialProductKey IS NOT NULL" call GetPolicyInformationString "Kernel-EditionName"
    

    not sure how would you implement that

    if you prefer Powershell commands:

    ((([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL').Get()).GetPolicyInformationDWord('Kernel-BrandingInfo')).PolicyValue
    
    ((([WMISEARCHER]'SELECT ID FROM SoftwareLicensingProduct WHERE ApplicationID=''55c92734-d682-4d71-983e-d6ec3f16059f'' AND PartialProductKey IS NOT NULL').Get()).GetPolicyInformationString('Kernel-EditionName')).PolicyValue
    
    0 comments No comments