Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

912 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

24 Experts available now in Live!

Get 1:1 Help Now