HostWeb Forums » Microsoft Server Operating Systems » microsoft.public.win2000.developer » Determining W2K version?

Topic: Re: Determining W2K version?

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 1/8/2008 11:50:45 AM

By: 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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Replies below ↓

Replies

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 1/22/2008 4:22:01 PM

By: Peter Hurford

Determining W2K version?

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

Reply | New Topic | This is SPAM | This is Offensive

Submitted: 1/22/2008 4:22:02 PM

By: Peter Hurford

Re: Determining W2K version?

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.

Contents
Home
Forums
About Us
Contact Us
Web Hosting:
Hosting Providers
How to choose a name
What is a Hosting Provider
Hosting Types
Choosing the right plan
 
Search
 
Login to HostWeb.com
Email
Password
If you do not have an account with us yet, join now - it's FREE!