Is there any way to get the OS name the user is currently using?
You can use
System.Environment
class
Environment.OSVersion.ToString()
See Environment.OSVersion Property
Gets an OperatingSystem object that contains the current platform identifier and version number.
You can use the Environment.OSVersion property.
Version version = Environment.OSVersion;
To decode the version, refer to the wikipedia page of Microsoft Windows Timeline. For example, if the version is 6.1.7600, then it is either a Windows 7 or a Windows Server 2008 R2.
Note that there is no direct API to get the OS name, because a same version can refer to multiple public OS names.
You cannot retrieve the OS name directly. Instead use the Environment.OSVersion.ToString(
) property to interpret the version & display the OS Name.
This article has a sample that will help you. It covers Win95 to Win7.
All you need to do is write a function that will return the OS name as shown in the above article.