HostWeb Forums » Microsoft Server Operating Systems » microsoft.public.win2000.developer » Determining W2K version?
Topic: Re: Determining W2K version?
>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
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
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.