Determining W2K version?


P

Peter Hurford

Hi,

The .net framework's Environment.OSVersion.Version......

api is fine and straightforward to get me to the main Windows
versions, but I note that it seems unable to differentiate between W2K
Pro, W2K Server etc. etc.

Can anyone remember how to do this?

Thanks,
Peter Hurford
 
Ad

Advertisements

M

Mattias Sjögren

The .net framework's Environment.OSVersion.Version......
api is fine and straightforward to get me to the main Windows
versions, but I note that it seems unable to differentiate between W2K
Pro, W2K Server etc. etc.

Can anyone remember how to do this?
You can call GetVersionEx with PInvoke to get that information.

http://msdn2.microsoft.com/en-us/library/ms724451(VS.85).aspx
http://support.microsoft.com/kb/304721

The code in the KB article uses the OSVERSIONINFO struct, you need to
use the extended OSVERSIONINFOEX instead and check wProductType.


Mattias
 
Ad

Advertisements

P

Peter Hurford

Mattias, thanks for your response.

Actually the way I found to do it was slightly different, although was
seemingly at one point in time Microsoft's "recommended" approach.

The key HKLM\System\CurrentControlSet\Control\ProductOptions contains
the ProductType value

This is WinNT (Workstation), ServerNT (standalone server) or LanmanNT
(Domain Controller)

These values appear to be both backward and forward compatible also,
for example they will work with NT4 & NT3.51, but also the two server
values appear good for W2K3 also (though of course if the framework
can give this information it will be far cleaner).

See http://support.microsoft.com/?kbid=152078 for more info.
 

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