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:
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
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



