I need to detect what type (edition) of Windows OS is installed. By type I mean, for example: "Home", "Enterprise" or "Professional". Please don't ask why (I've already had that uphill-struggle with the requirement-wizards).
Right now the problem is that the Windows types seem to be localized, and I need a way to use them in a switch statement to do different behavior.
Right now I do this:
_os = (from x in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem").Get().OfType<ManagementObject>()
select x.GetPropertyValue("Caption")).First().ToString().Trim();
switch (_os)
{
case "Microsoft Windows XP Professional":
{
// Do professional stuff...
break;
}
case "Microsoft Windows 7 Professional":
case "Microsoft Windows 7 Ultimate":
case "Microsoft Windows 7 Enterprise":
{
// Do ultimate enterprisey professional stuff
break;
}
default:
{
// File not found
break;
}
}
Anyone know how this could be done to not run into the issue of localization?