473,765 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting windows version and type

I can get the windows version number from System.Environm ent.OSVersion e.g.
"Windows NT 5.1.2600.0" for XP SP2.
I was wondering whether this tells you the type of windows it is or if you
have to use something else?
E.g. for windows 2000 do you just get a version number, or can you tell if
it is Professional, Server, Advanced Server, Datacenter Server.
Jul 21 '05 #1
3 2165
E.g. for windows 2000 do you just get a version number, or can you tell if
it is Professional, Server, Advanced Server, Datacenter Server.


Only the version number and whether it's an NT based version of
Windows (as opposed to Win9x). To differentiate between different
editions, use the GetVersionEx Win32 API function.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 21 '05 #2
I'd use something like below to get the enumerated platform ID.
It tells you whether the OS is NT or higher. One might want to
be more specific than that (or break it down further). It's more
direct thaan parsing the string (5.1 is really the platform ID of
Win32NT/enum)

The meaning of the platform ID enum is

Win32NT
Supported by the .NET Compact Framework.
The operating system is Windows NT or later.

Win32S
Supported by the .NET Compact Framework.
The operating system is Win32s. Win32s is a layer that runs on 16-bit
versions of Windows to provide access to 32-bit applications.

Win32Windows
Supported by the .NET Compact Framework.
The operating system is Windows 95 or later.

WinCE
Supported by the .NET Compact Framework.
The operating system is Windows CE .NET.

Here's a VB .NET sample to read it:

Private Environment As System.Environm ent
--------------------------

Dim OpSystem As OperatingSystem
Dim PlatformID As PlatformID
OpSystem = Environment.OSV ersion
PlatformID = OpSystem.Platfo rm

"James" wrote:
I can get the windows version number from System.Environm ent.OSVersion e.g.
"Windows NT 5.1.2600.0" for XP SP2.
I was wondering whether this tells you the type of windows it is or if you
have to use something else?
E.g. for windows 2000 do you just get a version number, or can you tell if
it is Professional, Server, Advanced Server, Datacenter Server.

Jul 21 '05 #3
I think its poor that Environment.OSV ersion doesn't have all the information
in.
It looks like you have to use Win32 API calls with OSVERSIONINFOEX as in the
following microsoft article:

http://msdn.microsoft.com/library/de...ui06042002.asp

now I just need to find out what the major/minor version numbers will be for
Win 2003.
Its ugly code having to hard-code it. What happens when the next version of
windows comes along? You'll have to keep updating your code.

"Ben Solomon" wrote:
I'd use something like below to get the enumerated platform ID.
It tells you whether the OS is NT or higher. One might want to
be more specific than that (or break it down further). It's more
direct thaan parsing the string (5.1 is really the platform ID of
Win32NT/enum)

The meaning of the platform ID enum is

Win32NT
Supported by the .NET Compact Framework.
The operating system is Windows NT or later.

Win32S
Supported by the .NET Compact Framework.
The operating system is Win32s. Win32s is a layer that runs on 16-bit
versions of Windows to provide access to 32-bit applications.

Win32Windows
Supported by the .NET Compact Framework.
The operating system is Windows 95 or later.

WinCE
Supported by the .NET Compact Framework.
The operating system is Windows CE .NET.

Here's a VB .NET sample to read it:

Private Environment As System.Environm ent
--------------------------

Dim OpSystem As OperatingSystem
Dim PlatformID As PlatformID
OpSystem = Environment.OSV ersion
PlatformID = OpSystem.Platfo rm

"James" wrote:
I can get the windows version number from System.Environm ent.OSVersion e.g.
"Windows NT 5.1.2600.0" for XP SP2.
I was wondering whether this tells you the type of windows it is or if you
have to use something else?
E.g. for windows 2000 do you just get a version number, or can you tell if
it is Professional, Server, Advanced Server, Datacenter Server.

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
15228
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 Personal disk from the SQL Server 2000 Enterprise kit as this is reported here on the MSDN web site to be the version that is supported on Windows XP. In fact so many of you kind people confess to having succeeded in doing it. I have tried...
2
6928
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on a type mismatch. It is positively because of the boolean(java primitive)parameter. It goes fine if I change this parameter to int or String. This inteface has a lot more methods which works fine, it is just the
1
2938
by: orit | last post by:
I have the following xml file: <?xml version="1.0" encoding="utf-8" ?> <course id="2555" title="Developing Microsoft .NET Applications for Windows (Visual C# .NET)" length="5 days" source="http://www.microsoft.com/learning/syllabi/en-us/2555Afinal.mspx"> <module id="1" title="Introducing Windows Forms" location="D:\Disk-C\Documents and Settings\orit_itzhar.ATRICA\My Documents\XML\csharp"> <lesson id="1.1"> <subject>Creating a...
8
10015
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'."
7
3213
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 think the username can be read with user.identity.name.
3
364
by: James | last post by:
I can get the windows version number from System.Environment.OSVersion e.g. "Windows NT 5.1.2600.0" for XP SP2. I was wondering whether this tells you the type of windows it is or if you have to use something else? E.g. for windows 2000 do you just get a version number, or can you tell if it is Professional, Server, Advanced Server, Datacenter Server.
2
5291
by: Praveen | last post by:
Hi All, I have made a webservice in C# and it works fine in my machine. I ran into a crazy problem when I wanted to deploy it in windows 2003 server. I have run "aspnet_regiis.exe -i" to make sure that the extensions for .asmx file etc are in place. I am getting http 404 when I give the url for the asmx file. the http error code is wrong because I am dead sure that the file is there. could you please let me know what else needs to be...
2
3087
by: Manikandan | last post by:
Hi, I have a program written in .Net Framework 1.1 using Visual studio enterprise edition 2003. I tried compiling the same program in visual c# express edition 2005. I'm getting following errors 1.Error 6 Cannot implicitly convert type 'mscomctl.Toolbar ' to 'mscomctl.Toolbar . An explicit conversion exists (are you missing a
1
2493
by: showbizzansh | last post by:
Server Error in '/ExportReport' Application. -------------------------------------------------------------------------------- Method 'ISCREditableRTFExportFormatOptions_reserved5' on type 'CrystalDecisions.ReportAppServer.ReportDefModel.EditableRTFExportFormatOptionsClass' from assembly 'CrystalDecisions.ReportAppServer.ReportDefModel, Version=11.0.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' is overriding a method that has been...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7378
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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 we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.