473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Detecting service packs

Hi,

I'm looking for a reliable way of detecting the version of Windows that the
..NET framework is installed on, specifically the service pack. Currently,
I'm using System.Environment.OSVersion and pulling the Major, Minor, Build
and Revision properties out of that.

However, e.g. Windows XP returns exactly the same values for no initial
build, SP1 or SP2.

I found the following site:
http://www.c-sharpcorner.com/FAQ/OSV...ngEnvClass.asp which makes
reference to a .CSD property of System.Environment.OSVersion, but I don't
think that's correct.

Is a call to the WinAPI GetVersionEx function the only way to achieve this?

Mark
Nov 16 '05 #1
1 1554
How about using WMI?

-- Code Start --
ObjectQuery oQuery = new System.Management.ObjectQuery("SELECT CSDVersion
FROM Win32_OperatingSystem");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oQuery);
ManagementObjectCollection result = oSearcher.Get();
foreach (ManagementObject mo in result) Console.WriteLine
(mo["CSDVersion"].ToString());
-- Code End --

HTH

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Oz**************@TK2MSFTNGP14.phx.gbl...
Hi,

I'm looking for a reliable way of detecting the version of Windows that the
..NET framework is installed on, specifically the service pack. Currently,
I'm using System.Environment.OSVersion and pulling the Major, Minor, Build
and Revision properties out of that.

However, e.g. Windows XP returns exactly the same values for no initial
build, SP1 or SP2.

I found the following site:
http://www.c-sharpcorner.com/FAQ/OSV...ngEnvClass.asp which makes
reference to a .CSD property of System.Environment.OSVersion, but I don't
think that's correct.

Is a call to the WinAPI GetVersionEx function the only way to achieve this?

Mark

Nov 16 '05 #2

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

Similar topics

1
by: Dave Phelan | last post by:
I am running SQL Server 6.5 on a W2K server. I recently encountered the problem described in Microsoft KB atricle 153455. The server has NO service packs installed on it. I have downloaded sp5a...
1
by: | last post by:
Hi, I'm going to install VS.NET 2003 which comes with v1.1 of the .NET SDK. My question is do I need to install the service packs or are they just for v1.0 of the Framwork ? Should I be aware...
10
by: sanket gupta | last post by:
Hi , When installing my application , i want to check whether the dot net runtime is available on the users computer and if its not , then i would like to provide him with a download location....
2
by: John Olbert | last post by:
We have a large application (the Exe is about 10 mb Released) built as a C++ unmanaged Solution under Vs2003. This App is targeted for Win2000. The latest Service Pack for Windows 2000 has...
16
by: Bruce A. Julseth | last post by:
I have VS 2002 and have NOT installed XP SP 2 on my XP Professional system. I seem to recall that SP 2 would mess up VS. Is this true? Thank you...
4
by: Jeremy S. | last post by:
About 6 months ago MS announced that a service pack for .NET Framework 2.0 and VS.NET (2003 and 2005) would be available around mid-year. Any update on that ETA? (we're approaching mid-year now) ...
0
by: =?Utf-8?B?S2FybCBQb3RoYXN0?= | last post by:
According to this page Crystal Reports for Visual Studio 2005 Service Pack 1 should be released soon. Does anyone know the exact release date for this? ...
2
by: =?Utf-8?B?bWFpdGFrZWJveQ==?= | last post by:
I just installed .net 2.0 and was prompted to look for updates and service packs. Unfortunately, they didn't tell me where to go for this. Can someone help me?
1
by: Salad | last post by:
I have a computer with Access 97, Office 2000 with Access, and A2003 runtime on it. I use Tony Toew's AutoFe and I'm having a problem with it. The user must first open my app up in A97 and then...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.