Jump to content

[How-to] Detect license type of windows


Sonic

Recommended Posts

Yes it's possible ...

Batch to detect Windows license, OEM or VL

for /f "skip=4 tokens=3" %%? in ('reg query HKLM\SYSTEM\Setup\Pid /v Pid') do set Pid=%%?
set Pid=%Pid:~-3%
if '%Pid%'=='270' echo WinXP VL version detected && WhatCommandYouWant
if '%Pid%'=='OEM' echo WinXP OEM version detected && WhatOtherCommandYouWant
exit

Credits to Yzöwl for his batch's knowledge !

Title edited as per request. --Zxian

Link to comment
Share on other sites


You should be able to get this information from the Win32_OperatingSystem class. http://msdn.microsoft.com/library/default....environment.asp Determining what type of media was used to install will require parsing Win32_OperatingSystem.SerialNumber. This document may help but its written for server versions http://support.microsoft.com/?kbid=889713

Link to comment
Share on other sites

hmm programming a exe just for that is too complicated for me (I must reinstall my old visual studio 2003 provided by my school ^^ ... and take several time ...)

I think there is a file/registry key/whatever differs from each channel (in fact is term from Microsoft to design 'version' Home,Pro, Corp) of Windows XP.

Edited by sonic
Link to comment
Share on other sites

Try this VBS script

strComputer = "."

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems

Msgbox objOperatingSystem.Caption & " " & objOperatingSystem.Version, 0 + 32,"Window Version"

Next

Link to comment
Share on other sites

okay gunsmokingman, but it's just for Pro or Home version ...

I think there is no differences between corp/vlk and pro in windows, but I think there is registry key or files for activation differs with retail version ...

Reading http://www.msfn.org/board/index.php?showtopic=61066, I will check the key [HKEY_LOCAL_MACHINE\SYSTEM\Setup\Pid] ...

Thanks all.

Goodbye.

EDIT:

My main command form my batch to check my windows xp version :

for /f "skip=4 tokens=3" %%i in ('reg query HKLM\SYSTEM\Setup\Pid /v Pid') do set Pid=%%i

Edited by sonic
Link to comment
Share on other sites

@Yahoo : not for corporate version ... there isn't differences between oem and corporate/vlk in windows itself ... we must check pid (or other regkey/files) or develop an exe in .net/c using microsoft api ...

Link to comment
Share on other sites

  • 1 month later...

Improved batch to detect Corporate version of Windows

for /f "skip=4 tokens=3" %%? in ('reg query HKLM\SYSTEM\Setup\Pid /v Pid') do set Pid=%%?
set Pid=%Pid:~-3%
if '%Pid%'=='270' echo Corporate version detected && WhatCommandYouWant
if not '%Pid%'=='OEM' echo OEM version detected && WhatOtherCommandYouWant
exit

Credits to Yzöwl for his batch's knowledge !

Edited by sonic
Link to comment
Share on other sites

Look at your product ID in the System Property sheet.

First set:

55274 : XP Professional

55276 : XP Professional upgrade

55276 : XP Home

55277 : XP Home

55285 : XP Professional

76487 : XP Media Center Edition 2005

76487 : XP Pro Royalty OEM

76487 : XP Pro volume license (with '640' channel ID)

Second set:

007 : retail

011 : upgrade

OEM : OEM

270 : Volume License

335 : Retail

640 : Volume License

648 : Academic

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...