Problem using Environment.OSversion?
-
I am using Environment.OSVersion for geting the Operation system version. My application is running on Microsoft Windows XP Professional Service pack 2. when i try to retrieve the os version see the code snippet: log.Info("ASET OSVersion=" + Environment.OSVersion); :) i am getting the following output: 2009-03-12 14:18:40,483 [INFO ] [3528] - ASET OSVersion=Microsoft Windows NT 5.1.2600 Service Pack 2 The output should be Micorsoft windows xp , but here it is giving some thing else. :( Can any one help me in this regard?
-
I am using Environment.OSVersion for geting the Operation system version. My application is running on Microsoft Windows XP Professional Service pack 2. when i try to retrieve the os version see the code snippet: log.Info("ASET OSVersion=" + Environment.OSVersion); :) i am getting the following output: 2009-03-12 14:18:40,483 [INFO ] [3528] - ASET OSVersion=Microsoft Windows NT 5.1.2600 Service Pack 2 The output should be Micorsoft windows xp , but here it is giving some thing else. :( Can any one help me in this regard?
AFAIK XP is recognized as NT platform only. I don't remember it exactly but I think it the OS is determined by 'Environment.OSVersion.version.Minor'. I think if the minor value is 3 it is XP. (I'm not sure...try google)
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
-
I am using Environment.OSVersion for geting the Operation system version. My application is running on Microsoft Windows XP Professional Service pack 2. when i try to retrieve the os version see the code snippet: log.Info("ASET OSVersion=" + Environment.OSVersion); :) i am getting the following output: 2009-03-12 14:18:40,483 [INFO ] [3528] - ASET OSVersion=Microsoft Windows NT 5.1.2600 Service Pack 2 The output should be Micorsoft windows xp , but here it is giving some thing else. :( Can any one help me in this regard?
You need to extract the product name from
Environment.OSVersion.Version.Minor
property. If it is 1 then it is XP. All the codes can be found here[^]. IMO to know if it is XP professional or home, you will need to use GetVersionEx by P/Invoking win32 api.Happy Holi[^] जय हिंद