?
Solved

vb.net - use .net to determine the version of OS ...

Posted on 2010-08-14
4
Medium Priority
?
517 Views
Last Modified: 2013-11-27
My vb.net is installed on my client and I need to determeine what version of the OS..where it is installed..is there a programatical way of determing this?
0
Comment
Question by:GlobaLevel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Accepted Solution

by:
fvitt72 earned 668 total points
ID: 33439053
If you are looking to see how to programmatically see what OS is installed look at this link:

http://www.vb-helper.com/howto_net_os_version.html

For the question, where it is installed?  Are you looking to find a programmatical way of checking to see where VB.NET is installed on each workstation?
0
 
LVL 17

Assisted Solution

by:Zhaolai
Zhaolai earned 668 total points
ID: 33439180
Here is the code to even detect Windows 7.
1. OS info: Download the attached class. To call the class, use the following code:

        Dim sb As New System.Text.StringBuilder([String].Empty)

        sb.AppendLine("Operation System Information")
        sb.AppendLine("----------------------------")
        sb.AppendLine([String].Format("Name = {0}", OSVersionInfo.Name))
        sb.AppendLine([String].Format("Edition = {0}", OSVersionInfo.Edition))
        If OSVersionInfo.ServicePack <> String.Empty Then
            sb.AppendLine([String].Format("Service Pack = {0}", OSVersionInfo.ServicePack))
        Else
            sb.AppendLine("Service Pack = None")
        End If
        sb.AppendLine([String].Format("Version = {0}", OSVersionInfo.VersionString))
        sb.AppendLine([String].Format("ProcessorBits = {0}", OSVersionInfo.ProcessorBits))
        sb.AppendLine([String].Format("OSBits = {0}", OSVersionInfo.OSBits))
        sb.AppendLine([String].Format("ProgramBits = {0}", OSVersionInfo.ProgramBits))

        TextBox1.Text = sb.ToString()

2. Where it is installed:
   If you just want to get the name of the computer where you program is running on, use:

   My.Computer.Name

OSVersionInfo.vb
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33439221
would this work..I saw on a recent EE posting...
Public Function OS_VERSION() As String
        '  WE NEED TO DETERMINE THE VERSION OF THE OS
        Dim osInfo As OperatingSystem
        Dim sAns As String
        sAns = ""
        osInfo = System.Environment.OSVersion
        With osInfo
            Select Case .Platform
                Case System.PlatformID.Win32Windows
                    Select Case (.Version.Minor)
                        Case 0
                            sAns = "Windows 95"
                            OLD_WINDOWS_VERSION()
                        Case 10
                            If .Version.Revision.ToString() = "2222A" Then
                                sAns = "Windows 98 Second Edition"
                                OLD_WINDOWS_VERSION()
                            Else
                                sAns = "Windows 98"
                                OLD_WINDOWS_VERSION()
                            End If
                        Case 90
                            sAns = "Windows Me"
                            OLD_WINDOWS_VERSION()
                    End Select
                Case System.PlatformID.Win32NT
                    Select Case (.Version.Major)
                        Case 2
                            sAns = ""
                            WINDOWS_NT_VERSION()
                        Case 3
                            sAns = "Windows NT 3.51"
                            WINDOWS_NT_VERSION()
                        Case 4
                            sAns = "Windows NT 4.0"
                            WINDOWS_NT_VERSION()
                        Case 5
                            If .Version.Minor = 0 Then
                                sAns = "Windows 2000"
                                WINDOWS_NT_VERSION()
                            ElseIf .Version.Minor = 1 Then
                                sAns = "Windows XP"
                                WINDOWS_NT_VERSION()
                            ElseIf .Version.Minor = 2 Then
                                sAns = "Windows Server 2003"
                                WINDOWS_NT_VERSION()
                            Else 'Future version maybe update
                                'as needed
                                sAns = "Unknown Windows Version"
                                WINDOWS_NT_VERSION()
                            End If
                        Case 6
                            Select Case .Version.Minor
                                Case 0I
                                    sAns = "Windows Vista"
                                    RECENT_WINDOWS_VERSION()
                                Case 1I
                                    sAns = "Windows 2008"
                                    RECENT_WINDOWS_VERSION()
                                Case 2I
                                    sAns = "Windows 7"
                                    RECENT_WINDOWS_VERSION()
                            End Select
                    End Select
            End Select
        End With
        Return sAns
0
 
LVL 19

Assisted Solution

by:Shahan Ayyub
Shahan Ayyub earned 664 total points
ID: 33440079
Hi! GlobaLevel

You found a solution in the above post. I also recommend Environment.OSVersion if it was not present here.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question