How to display OS Name in short Name eg Win Vista SP1
Win XP
2003 SP2


Regards,
Tee ET

Re: How to display OS Name in short name ? by kimiraikkonen

kimiraikkonen
Wed Jul 23 05:51:06 CDT 2008

On Jul 23, 12:21 pm, "engteng" <pass...@gmail.com> wrote:
> How to display OS Name in short Name eg Win Vista SP1
> Win X=
P
> 2003 SP2
>
> Regards,
> Tee ET

For XP,
You can you can manually define them in nested if-then blocks like the
following:

' --------Begin Code-----------

'Check and get full OSName
If My.Computer.Info.OSFullName.ToString =3D _
"Microsoft Windows XP Professional" Then
'Check and get service pack version
If Environment.OSVersion.ServicePack.ToString =3D _
"Service Pack 2" Then
MsgBox("Win XP SP2")
End If
ElseIf My.Computer.Info.OSFullName.ToString =3D _
"Microsoft Windows XP Professional" Then
'Assuming no or other Service Packs are installed
' plus only XP is installed
MsgBox("Win XP")
End If

'.....Reproduce same for Vista

' ------End Code-----------

Or you can use substring method to fit OSName/SPVersion output to what
you desire.


Hope this helps,

Onur G=FCzel

Re: How to display OS Name in short name ? by Stanimir

Stanimir
Wed Jul 23 10:24:41 CDT 2008

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

"engteng" <passrcv@gmail.com> wrote in message
news:uFqfMWK7IHA.1080@TK2MSFTNGP06.phx.gbl...
> How to display OS Name in short Name eg Win Vista SP1
> Win XP
> 2003 SP2
>
>
> Regards,
> Tee ET
>


Re: How to display OS Name in short name ? by Herfried

Herfried
Wed Jul 23 14:01:33 CDT 2008

"engteng" <passrcv@gmail.com> schrieb:
> How to display OS Name in short Name eg Win Vista SP1
> Win XP
> 2003 SP2

These short names are not defined by Microsoft. Microsoft uses (for legal
reasons, I assume) only the complete names of their products.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>