Solved

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

Posted on 2010-08-14
4
499 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
4 Comments
 

Accepted Solution

by:
fvitt72 earned 167 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi! GlobaLevel

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now