Created
February 2, 2016 21:10
-
-
Save sebingel/29eb0dbc0802d3b04bdd to your computer and use it in GitHub Desktop.
Gets the friendly OS Name in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string name = (from x in new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem").Get().Cast<ManagementObject>() | |
select x.GetPropertyValue("Caption")).FirstOrDefault(); | |
System.Console.WriteLine(name != null ? name.ToString() : "Unknown"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment