Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Operating system (Help Please)

Hello everyone i have not asked for help in while but when i am trying to pull the osversion fr windows 10 and it reads as windows 8.

My code is here:

Code
public static string OSName()
        {
            string osName = "";
            OperatingSystem oSVersion = Environment.OSVersion;
            if (oSVersion.Platform == PlatformID.Win32NT)
            {
                if (oSVersion.Version.Major == 5)
                {
                    switch (oSVersion.Version.Minor)
                    {
                        case 0:
                            osName = "2K";
                            break;

                        case 1:
                            osName = "XP";
                            break;

                        case 2:
                            osName = "2k3";
                            break;
                    }
                }
                if (oSVersion.Version.Major == 6)
                {
                    switch (oSVersion.Version.Minor)
                    {
                        case 0:
                            osName = "VI";
                            break;

                        case 1:
                            osName = "W7";
                            break;

                        case 2:
                            osName = "W8";
                            break;
                        

                    }
                }
               if(oSVersion.Version.Major == 10)
                  {
                     switch (oSVersion.Version.Minor)
                      {
                          case 0:
                             osName = "W10";
                              break;
            }
}
}

I am trying to get the correct major and minor numbers so it will read the correct operating system. I'm sure i am making a mistake somewhere but can't figure it out. It reads windows 10 as windows 8
https://stackoverflow.com/questions/2819...ion-in-net
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
(Dec 14, 2019 11:00 AM)HFDone Wrote:  https://stackoverflow.com/questions/2819...ion-in-net

Yes i have looked at all that and even with correct changes it still reads as windows 8 when its a windows 10 machine.
https://docs.microsoft.com/en-us/dotnet/...mework-4.8


PHP Code

<?php 
new ComputerInfo().OSFullName.ToString() 
https://www.prugg.at/2019/09/09/properly...windows-10
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
(Dec 14, 2019 11:22 AM)__Digital__ Wrote:  Yes i have looked at all that and even with correct changes it still reads as windows 8 when its a windows 10 machine.

if you really want to use this helper class what prevents you to modify it ,because generally you have more or less everything there and changes thet you will make there is very easy following an already existing concept.
buy me a coffee eth:0x88621A52aa5Eb3b6503628369687111810186c58
You could try something similar to this. Returns the version number of the OS. Can be used to find the name of the OS using this page.



My bad if a better method exists. This is just what came to mind.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by BlvckGodJan 1, 2017 11:13 PM 7 268 Jan 1, 2017 11:13 PM
Last Post: Malum™
[C#] by ChickendipperOct 1, 2016 07:14 AM 3 194 Oct 1, 2016 07:14 AM
Last Post: waxokrix
[C#] by Obi-Wan CannabisSep 28, 2016 03:23 AM 59 1,466 Sep 28, 2016 03:23 AM
Last Post: zarlo5899