I want to find what OS version (e.g.: Window 7 Pro) is on drive D: without digging through D:\Windows\System32\license.rtf
Is there a class within System.Management namespace that will let me find OS Versions on a specified local drive letter?
I want to find what OS version (e.g.: Window 7 Pro) is on drive D: without digging through D:\Windows\System32\license.rtf
Is there a class within System.Management namespace that will let me find OS Versions on a specified local drive letter?
//This will help you detect the version of the OS for NT based system, if ntoskrnl.exe doesnt exist its ME/95/98
var DriveLetter = "D"; //D drive.
var pathTontoskrnl = string.Format("{0}:\\{1}", DriveLetter, "\\Windows\System32\ntoskrnl.exe");
if (!File.Exists(pathTontoskrnl))
{
Console.WriteLine("Windows ME/95/98");
}
var versionInfo = FileVersionInfo.GetVersionInfo(pathTontoskrnl);
string version = versionInfo.ProductVersion;
if ( version.StartsWith("5.1") )
{
Console.WriteLine("XP");
}
//4.x: NT 4.x
//5.0: Win2k
//5.1: WinXP
//5.2: Win2003 or XP-x64
//6.0: WinVista
//6.1: Win7
//6.2; Win8
//6.3: Win8.1
//6.4: Win10 ??? (not sure)