What is the simplest way to differentiate between Windows versions?
c#, windows
Solution
Doesn't that same page you link give you the answer?
Windows Server 2008 OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows Vista OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Just check the `wProductType` member against `VER_NT_WORKSTATION`
edit
Doesn't look like there's a way to get this without P/Invoke. `System.Environment.OSVersion` doesn't expose this level of detail, and though there is an `internal static class Win32Native` in the `Microsoft.Win32` namespace in `mscorlib`, as far as I can tell from disassembly, there's nothing that uses, let alone exposes, `wProductType`.
I have found (but not tried) this page on pinvoke.net.
Problem
How do I know programmatically whether my OS is Longhorn server or Vista (client). It seems the major version and minor version are same for both: http://msdn.microsoft.com/en-us/library/ms724833.aspx So, is there any better alternative?