how do I know programaticcally 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(VS.85).aspx
so, is there any better alternative?
how do I know programaticcally 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(VS.85).aspx
so, is there any better alternative?
For Server,
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
For Workstation
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
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.