Windows OS Version

|
 Public Function GetOSVersion() As String
        Dim sOSType As String = ""
        Select Case Environment.OSVersion.Platform
            Case PlatformID.Win32S
                sOSType = "Win 3.1"
            Case PlatformID.Win32Windows
                Select Case Environment.OSVersion.Version.Minor
                    Case 0
                        sOSType = "Win95"
                    Case 10
                        sOSType = "Win98"
                    Case 90
                        sOSType = "WinME"
                    Case Else
                        sOSType = "Unknown"
                End Select
            Case PlatformID.Win32NT
                Select Case Environment.OSVersion.Version.Major
                    Case 3
                        sOSType = "NT 3.51"
                    Case 4
                        sOSType = "NT 4.0"
                    Case 5
                        Select Case _
                            Environment.OSVersion.Version.Minor
                            Case 0
                                sOSType = "Win2000"
                            Case 1
                                sOSType = "WinXP"
                            Case 2
                                sOSType = "Win2003"
                        End Select
                    Case 6
                        sOSType = "Vista"
                    Case Else
                        sOSType = "Unknown"
                End Select
            Case PlatformID.WinCE
                sOSType = "Win CE"
        End Select
        Return sOSType
    End Function
If GetOSVersion() = "WinXP" Then
  'Computer is Windows XP
End If
Originally Posted on December 14, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.