How to obtain Operating System information in .NET

Waqas Anwar
16 July 2009
8568 Views

If you want to know the basic information such as operating system name, version, service pack or platform name of the operating system on which your .NET application is running you can use following properties of Environment class.

Console.WriteLine(Environment.OSVersion);
Console.WriteLine(Environment.OSVersion.Version);
Console.WriteLine(Environment.OSVersion.ServicePack);
Console.WriteLine(Environment.OSVersion.Platform);