Operating System Key in C# (WMI)

  • Thread starter christophe roumegous
  • Start date
C

christophe roumegous

Hello,
I just want to know the key (licence number) of the operating system used by
my computer.
Then I use the WMI API in C#.

I tried to used the classes :
"Win32_OperatingSystem"
"Win32_ComputerSystemProduct"

For the "Win32_OperatingSystem" class I used the SerialNumber member.
However it gives a number like "10497-OEM-0031416-71674" which is not what I
need.

For the "Win32_ComputerSystemProduct" class I used "IdentifyingNumber" which
give me nothing
but the string: "System Serial Number" and "UUID".

"UUID" gives me 5 groups of numbers seperated by "-". Just like a Windows
serial key.
However, the key I need is the one you have to enter to install your Windows
XP. This key (mine in fact) has numbers and letters (5 groups of 5 letters
or numbers).

I do not want to find the license key of my OS since I allready have it.
(Please do not answer: "xxxxxx.exe is a program that can do it"). It is for
a C# application that identifies computers to be maintained.

Thanks, Christophe.
 
N

Nicholas Paldino [.NET/C# MVP]

Christophe,

I don't think that this is possible, for security reasons. I would not
have the activation key stored on a system for any reason. If anything, on
install, I would check the validity of the key and then throw it out. I
imagine MS does something to that effect as well (kind of like storing a
password on the machine, it's just not done, a hash is stored).

I doubt you will be able to do this.

Hope this helps.
 
F

Francois Beaussier

:
OK, I understand the reasons. But which I cannot understand is that I know a
software that can give you the key licence number of your OS.

I have been told that in winXP the serial is written in the following file

C:\WINDOWS\SYSTEM32\$WINNT$.INF

[userdata]
productkey=Your key is here

However, since i am running a 2003 server the field was empty on my
computer :(

Give it a try :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top