Question: I am currently working on a C# project. I want to collect users statistics to better develop the software. I am using the `Environment.OS` feature of C# but its only showing the OS name as something like **Microsoft Windows NT**

What I want to be able to **retrieve** is the *actual known name of the OS* like whether it is `Windows XP, Windows Vista or Windows 7` and etc. 

Is this possible?

Answer: 
Add a .NET reference to Microsoft.VisualBasic. Then call:

```
new Microsoft.VisualBasic.Devices.ComputerInfo().OSFullName

```

From [MSDN](https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.devices.computerinfo.osfullname(v=vs.110).aspx):

> 
> This property returns detailed information about the operating system name if Windows Management Instrumentation (WMI) is installed on the computer. Otherwise, this property returns the same string as the `My.Computer.Info.OSPlatform` property, which provides less detailed information than WMI can provide.information than WMI can provide.
> 
> 
>
Though this is not a fully C# way of detecting the OS Name, below code works for my needs-

```
public static string GetFriendlyOSName()
    {
        System.Diagnostics.Process cmd = new System.Diagnostics.Process();
        cmd.StartInfo.FileName = "cmd.exe";
        cmd.StartInfo.Arguments = "/C systeminfo | findstr /c:\"OS Name\"";
        cmd.StartInfo.RedirectStandardOutput = true;
        cmd.StartInfo.UseShellExecute = false;
        cmd.StartInfo.CreateNoWindow = true;
        cmd.Start();
        cmd.WaitForExit();
        string output = cmd.StandardOutput.ReadToEnd();
        cmd.Close();
        return output.Split(new[] { ':' }, 2)[1].Trim();
    }

```

Note:

1. This code works for only Windows OS.
2. The code is tested only on Windows 10, 11.