Click here to Skip to main content
15,911,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

please refer this link

OS Name, Version & Product Type[^]


Im trying to find what type of OS as my output.
The scenario given in this link fails while finding whether its server or workstation.
Its retuning the value as 6.2 for both win 8 and win server 2012.

can u please help me how to fix this issue?


Thanks
Prem

What I have tried:

I have tried searching in sites but didn't get any solution.please help me
Posted
Comments
dan!sh 17-Feb-16 8:07am    
What do you get in product type?

You must check the build number. A list can be found by searching the web (e.g. Windows build numbers · GitHub[^]).

[UPDATE]
See also Operating System Version (Windows)[^] and IsWindowsServer at Version Helper functions (Windows)[^]
[/UPDATE]

[UPDATE2]
See also the CP article Getting Operating System Version Info - Even for Windows 10![^].
[UPDATE2]
 
Share this answer
 
v3
Comments
Kornfeld Eliyahu Peter 17-Feb-16 8:15am    
Not exactly right - there are overlapping between Win 7 and Server 2008 R2 and Win 8 and Server 2012...
Jochen Arndt 17-Feb-16 8:17am    
I had just updated my answer to use IsWindowsServer.
Kornfeld Eliyahu Peter 17-Feb-16 8:22am    
Great...Didn't know there is such helper function...
Jochen Arndt 17-Feb-16 8:24am    
Using the helper function is the new (recommended) way.
Kornfeld Eliyahu Peter 17-Feb-16 8:27am    
Yeah...I left WIN32 years ago, there were no helper functions then...
To be sure, you have to go to the WIN32 API...
GetVersionEx function (Windows)[^]
The OSVERSIONINFOEX structure[^] has a wProductType member...The answer is there...
 
Share this answer
 
Comments
premkumar.r 17-Feb-16 9:20am    
Im using C# coding.the link you have belongs to VC++.How to analyse this.i didnt get any idea.can u please give me some idea of how to execute in C# or VB?
Thanks
Kornfeld Eliyahu Peter 17-Feb-16 9:23am    
https://msdn.microsoft.com/en-us/library/172wfck9.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900