Solved

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

Posted on 2010-08-14
4
513 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 167 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 167 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 166 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

736 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