08-28-2010, 08:42 AM
Code:
' Generate Operating System
Public Shared Function GenerateOperatingSystem() As String
Dim os As System.OperatingSystem = System.Environment.OSVersion : Dim osName As String = "UN" : Select Case os.Platform
Case System.PlatformID.Win32Windows : Select Case os.Version.Minor
Case 0 : osName = "95" : Exit Select : Case 10 : osName = "98" : Exit Select : Case 90 : osName = "ME" : Exit Select : End Select : Exit Select
Case System.PlatformID.Win32NT : Select Case os.Version.Major
Case 3 : osName = "NT" : Exit Select : Case 4 : osName = "NT" : Exit Select
Case 5 : If os.Version.Minor = 0 Then : osName = "2K" : ElseIf os.Version.Minor = 1 Then : osName = "XP" : ElseIf os.Version.Minor = 2 Then : osName = "2K3" : End If : Exit Select
Case 6 : osName = "VS" : If os.Version.Minor = 0 Then : osName = "VS" : ElseIf os.Version.Minor = 1 Then : osName = "W7" : End If : Exit Select : End Select : Exit Select : End Select : Return osName
End Function
Another Usefull snippet I made up.