473,549 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Environm ent.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.Environm ent.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 1567
How about using WMI?

-- Code Start --
ObjectQuery oQuery = new System.Manageme nt.ObjectQuery( "SELECT CSDVersion
FROM Win32_Operating System");
ManagementObjec tSearcher oSearcher = new ManagementObjec tSearcher(oQuer y);
ManagementObjec tCollection result = oSearcher.Get() ;
foreach (ManagementObje ct mo in result) Console.WriteLi ne
(mo["CSDVersion "].ToString());
-- Code End --

HTH

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Oz******** ******@TK2MSFTN GP14.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.Environm ent.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.Environm ent.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
2067
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 from the MS site and tried to install it, but I am told that SQL Server is not installed on the machine, which it is. I know this is a stretch, but...
1
1231
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 of any Service Packs & Patches for .NET v1.1 ? Thanks, Steve.
10
2340
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. What is the easiest way to do it? Thanks/Regards Sanket Gupta *** Sent via Developersdex http://www.developersdex.com *** Don't just participate...
2
1428
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 presented us with some problems. Because we are an ISO 9000 company supplying software to the drug industry we have strict requirements on the need for...
16
1684
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
1389
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) Just curious (and yes, I googled this and found nothing helpful) -J
0
4853
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? http://support.microsoft.com/default.aspx/kb/928957 ***from article**** Crystal Reports for Visual Studio 2005 Service Pack 1: Crystal Reports for Visual Studio 2005 Service Pack 1 will be...
2
1282
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
1516
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 he can open the app in A2003. If A97 is not open and the person attempts to open the app up in A2003 he receives the message "couldn't find file...
0
7542
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...
0
7467
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...
0
7736
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7500
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...
0
7827
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5385
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...
0
3514
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3494
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1079
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.