How to display OS Name in short name ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • engteng

    How to display OS Name in short name ?

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


    Regards,
    Tee ET


  • kimiraikkonen

    #2
    Re: How to display OS Name in short name ?

    On Jul 23, 12:21 pm, "engteng" <pass...@gmail. comwrote:
    How to display OS Name in short Name eg Win Vista SP1
    Win XP
    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.Inf o.OSFullName.To String = _
    "Microsoft Windows XP Professional" Then
    'Check and get service pack version
    If Environment.OSV ersion.ServiceP ack.ToString = _
    "Service Pack 2" Then
    MsgBox("Win XP SP2")
    End If
    ElseIf My.Computer.Inf o.OSFullName.To String = _
    "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üzel

    Comment

    • Stanimir Stoyanov

      #3
      Re: How to display OS Name in short name ?

      My way of getting a proper OS version string + SP number:

      Function GetOSVersion() As String
      Dim os As OperatingSystem = Environment.OSV ersion
      Dim displayName As String = "Win "
      Dim origSp As String = os.ServicePack

      If String.IsNullOr Empty(origSp) Then
      origSp = ""
      Else
      origSp = origSp.Replace( "Service Pack", "").Trim()
      End If

      Select Case os.Platform
      Case PlatformID.Win3 2Windows ' 95, 98, ME
      Select Case os.Version.Mino r
      Case 0 : displayName &= "95"
      Case 10
      displayName &= "98"

      If os.Version.Revi sion.ToString() = "2222A" Then
      displayName &= " SE"
      End If
      Case 90 : displayName &= "ME"
      End Select

      Case PlatformID.Win3 2NT
      Select Case os.Version.Majo r
      Case 3 : displayName &= "NT 3.51"
      Case 4 : displayName &= "NT 4"
      Case 5
      Select Case os.Version.Mino r
      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.Tri m()
      End Function

      Best Regards,
      Stanimir Stoyanov | www.stoyanoff.info

      "engteng" <passrcv@gmail. comwrote in message
      news:uFqfMWK7IH A.1080@TK2MSFTN GP06.phx.gbl...
      How to display OS Name in short Name eg Win Vista SP1
      Win XP
      2003 SP2
      >
      >
      Regards,
      Tee ET
      >

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: How to display OS Name in short name ?

        "engteng" <passrcv@gmail. comschrieb:
        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/>

        Comment

        Working...