Get Activation method Digital Entitlement via WMI?

Discussion in 'Windows 10' started by 38956, Dec 14, 2015.

  1. 38956

    38956 MDL Member

    Jun 7, 2010
    130
    137
    10
    #1 38956, Dec 14, 2015
    Last edited by a moderator: Apr 20, 2017
  2. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,132
    540
    60
    #2 Superfly, Dec 14, 2015
    Last edited by a moderator: Apr 20, 2017
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,132
    540
    60
    #3 Superfly, Dec 14, 2015
    Last edited by a moderator: Apr 20, 2017
    This is also something new...

    Code:
    using System;
    using System.Management;
    using System.Windows.Forms;
    
    namespace WMISample
    {
        public class CallWMIMethod
        {
            public static void Main()
            {
                try
                {
                    ManagementObject classInstance = 
                        new ManagementObject("root\\CIMV2", 
                        "SoftwareLicensingService.Version='10.0.10586.0'",
                        null);
    
                    // Obtain in-parameters for the method
                    ManagementBaseObject inParams = 
                        classInstance.GetMethodParameters("AcquireGenuineTicket");
    
                    // Add the input parameters.
                    inParams["ServerUrl"] =  "The activation server URL";
                    inParams["TemplateId"] =  "Most likely the GT code goes here";
    
                    // Execute the method and obtain the return values.
                    ManagementBaseObject outParams = 
                        classInstance.InvokeMethod("AcquireGenuineTicket", inParams, null);
    
                    // List outParams
                    Console.WriteLine("Out parameters:");
                    Console.WriteLine("ReturnValue: " + outParams["ReturnValue"]);
                }
                catch(ManagementException err)
                {
                    MessageBox.Show("An error occurred while trying to execute the WMI method: " + err.Message);
                }
            }
        }
    }
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Bezalel

    Bezalel MDL Member

    Apr 30, 2012
    230
    23
    10
    Do you have any reason to suspect that your PC has any information as to where the Digital Entitlement came from? My PCs upgraded from 8.1 KMS initially reported having a MAK license but on a reinstall it now lists it as Retail.
     
  5. kaos420

    kaos420 MDL Senior Member

    Jul 30, 2009
    269
    12
    10
    mine says this and i upgraded from a bought 8.1 key i paid for. sooo idk.
     
  6. Wolfano

    Wolfano MDL Novice

    Aug 18, 2015
    47
    6
    0
    Does the Enterprise version not eligible for Digital Entitlement?
    I upgraded Ent 10240 MAK activated to 10586 using ISO and it does not retain its activation.
     
  7. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    17,492
    15,278
    340
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    7,545
    23,957
    240
    Actually no, it's there since Win7 (at least)
    and was DEPRECATED since Win8 (open %WinDir%\System32\wbem\sppwmi.mof to see)
     
  9. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,132
    540
    60
    #9 Superfly, Dec 15, 2015
    Last edited by a moderator: Apr 20, 2017
    OIC... Thanx.

    BTW @OP, there's no way to determine the origin of activation only thing is to check for DE:
    Code:
    Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") 
    Set colItems = objWMIService.ExecQuery( _
        "SELECT LicenseStatusReason FROM SoftwareLicensingProduct WHERE LicenseStatus = 1",,48) 
    For Each objItem in colItems 
    If objItem.LicenseStatusReason=1074066433 Then Msgbox ( "Windows 10 on this device is activated with  digital entitlement")
    Next
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. 38956

    38956 MDL Member

    Jun 7, 2010
    130
    137
    10
    LicenseStatusReason (SoftwareLicensingProduct)

    Has anyone got a list of License Status Reason codes and what the codes mean?
     
  11. Superfly

    Superfly MDL Expert

    Jan 12, 2010
    1,132
    540
    60
    #11 Superfly, Dec 16, 2015
    Last edited by a moderator: Apr 20, 2017
    There isn't a definitiive list - it reports 0x0 if SPP is happy otherwise the error code (blocked key or whatever)

    You can use this to test:
    Code:
    Add-Type -AssemblyName PresentationCore,PresentationFramework
    $Result = Get-WmiObject -Query "SELECT LicenseStatusReason FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND Description LIKE 'Windows%'" 
    
    switch ($Result.LicenseStatusReason)
            {
            
                "0" {
                [System.Windows.MessageBox]::Show("Windows 10 on this device is activated with a product key")
                break;}
    
                "1074066433" {
                [System.Windows.MessageBox]::Show("Windows 10 on this device is activated with digital entitlement")
                break;
                }
    
                # Check error code
                Default {Invoke-Expression ("cmd.exe /c slui.exe 0x2a " + $Result.LicenseStatusReason)}
            }
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...