473,503 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gettin' windows name (version)

6 New Member
Hi Everyone,

I'm trying to get the windows version (not the numbered version like 6.0 (Vista) or 5.0). To do it I know that I can use the System.Environment.OSVersion.

What I really need is the name, like 'Windows XP Professional' or 'Windows XP Home' etc. I need this cause I'll check it in a installer. If the user OS is Home, i'll send a message.

Does anyone knows how to do it?

thanks
Fernando
Aug 26 '08 #1
5 1088
Plater
7,872 Recognized Expert Expert
Well windows xp home is a different number then xp pro right?

Regardless, I think there is some WMI that can be used to get it

From WMI Code Creater:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Management;
  3. using System.Windows.Forms;
  4.  
  5. namespace WMISample
  6. {
  7.     public class MyWMIQuery
  8.     {
  9.         public static void Main()
  10.         {
  11.             try
  12.             {
  13.                 ManagementObjectSearcher searcher = 
  14.                     new ManagementObjectSearcher("root\\CIMV2", 
  15.                     "SELECT * FROM Win32_OperatingSystem"); 
  16.  
  17.                 foreach (ManagementObject queryObj in searcher.Get())
  18.                 {
  19.                     Console.WriteLine("-----------------------------------");
  20.                     Console.WriteLine("Win32_OperatingSystem instance");
  21.                     Console.WriteLine("-----------------------------------");
  22.                     Console.WriteLine("Caption: {0}", queryObj["Caption"]);
  23.                     Console.WriteLine("Version: {0}", queryObj["Version"]);
  24.                 }
  25.             }
  26.             catch (ManagementException e)
  27.             {
  28.                 MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
  29.             }
  30.         }
  31.     }
  32. }
  33.  
Aug 26 '08 #2
joedeene
583 Contributor
another link is Link 1 it gives you numbers but there is a table that shows you what they mean.
Aug 26 '08 #4
aaronmorlocks
6 New Member
Thnx ! It works!

But now I have another problem, I need to get the Windows Edition, i.e. Vista Home Basic, Vista Ultimate, XP Professional, XP Starter Edition etc...

Should I read the registry?
Aug 27 '08 #5
Plater
7,872 Recognized Expert Expert
The code I posted should be able to show that (or you might need to add a few more properties from the selection, there are plenty available)
Aug 27 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
3677
by: Bob Everland | last post by:
I have an application that is ISAPI and the only way to secure it is through NT permissions. I need to have a way to login to windows authentication so that when I get to the ISAPI application no...
2
15206
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
7
3192
by: lvpaul | last post by:
Hallo ! I am using IIS-Windows-Authentication in my intranet (web.config <authentication mode="Windows" /> <identity impersonate="true" /> How can I get the users (client) IP-Address ? I...
8
7879
by: J.S. | last post by:
I was under the impression that frames could be used in Windows forms in earlier version of VB. However, in VB 2005 Express I don't see any such tool/control. Is SplitContainer used for this...
10
6928
by: PH | last post by:
Hi guys! I need to get the remote EndPoint from when I receive packets when listening in a local port in my computer. I'm using UDP (connection-less) so I only bind the socket to my...
17
5069
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the...
4
4158
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
10
2134
by: deathtospam | last post by:
My employer is starting to take the first steps towards migrating its Classic ASP codebase to ASP.NET v2.0. We have a copy of our existing website on the new Windows Server 2003 R2 test server,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.