vs4vijay
vs4vijay

Reputation: 1205

How to check if a Windows version is Genuine or not?

Is it possible to check whether a Windows installation is Genuine or not programmatically? Lets just say I want to check Windows 7 from C, C++, Java or Python.

Upvotes: 2

Views: 2441

Answers (3)

Davide Piras
Davide Piras

Reputation: 44605

this from CodeProject, in C++ ( Check for Windows Genuine in VC++ )

#include <slpublic.h>
#pragma comment(lib,"Slwga.lib")

bool IsWindowsGenuine()
{
    GUID uid;
    RPC_WSTR rpc=(RPC_WSTR)_T("55c92734-d682-4d71-983e-d6ec3f16059f");
    UuidFromString(rpc,&uid);
    SL_GENUINE_STATE state;
    SLIsGenuineLocal(&uid,&state,NULL);
    return state == SL_GENUINE_STATE::SL_GEN_STATE_IS_GENUINE;
}

Upvotes: 2

Stephen C
Stephen C

Reputation: 718758

The Java solution is to use Process to run the C++ or VBScript solution as a child process.

Upvotes: 0

Preet Sangha
Preet Sangha

Reputation: 65476

From here: Here is a vbscript that does it

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colWPA = objWMIService.ExecQuery _
("Select * from Win32_WindowsProductActivation")
For Each objWPA in colWPA
Wscript.Echo "Activation Required: " & objWPA.ActivationRequired
Wscript.Echo "Description: " & objWPA.Description
Wscript.Echo "Product ID: " & objWPA.ProductID
Wscript.Echo "Remaining Evaluation Period: " & _
objWPA.RemainingEvaluationPeriod
Wscript.Echo "Remaining Grace Period: " & objWPA.RemainingGracePeriod
Wscript.Echo "Server Name: " & objWPA.ServerName
Next

Upvotes: 1

Related Questions