My way of getting a proper OS version string + SP number:
Function GetOSVersion() As String
Dim os As OperatingSystem = Environment.OSVersion
Dim displayName As String = "Win "
Dim origSp As String = os.ServicePack
If String.IsNullOrEmpty(origSp) Then
origSp = ""
Else
origSp = origSp.Replace("Service Pack", "").Trim()
End If
Select Case os.Platform
Case PlatformID.Win32Windows ' 95, 98, ME
Select Case os.Version.Minor
Case 0 : displayName &= "95"
Case 10
displayName &= "98"
If os.Version.Revision.ToString() = "2222A" Then
displayName &= " SE"
End If
Case 90 : displayName &= "ME"
End Select
Case PlatformID.Win32NT
Select Case os.Version.Major
Case 3 : displayName &= "NT 3.51"
Case 4 : displayName &= "NT 4"
Case 5
Select Case os.Version.Minor
Case 0 : displayName &= "2000"
Case 1 : displayName &= "XP"
Case 2 : displayName &= "2003"
End Select
Case 6 : displayName &= "Vista"
Case 7 : displayName &= "7"
End Select
End Select
If origSp.Length > 0 AndAlso origSp <> "0" Then
displayName &= " SP" & origSp
End If
Return displayName.Trim()
End Function
Best Regards,
Stanimir Stoyanov |
www.stoyanoff.info