Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect Operating System

Tags:

vb.net

I would like to know how to detect if a persons operating system is Windows 7, I'm a bit new and have no idea how to do this. Please let me know if it is possible and the code to do it.

like image 207
alex Avatar asked Jul 02 '11 04:07

alex


People also ask

How do you detect the OS?

Nmap uses TCP/IP stack fingerprinting for OS detection. This is done by crafting custom TCP and UDP packets and analyzing their responses. After generating various such probes and comparing the results to the Nmap-os-db database of more than 2,600 known OS fingerprints and provides the OS version.

Can Nmap detect OS?

Nmap can use scans that provide the OS, version, and service detection for individual or multiple devices.

How does C++ detect operating system?

To check the operating system of the host in a C or C++ code, we need to check the macros defined by the compiler (GNU GCC or G++). For example, on Windows platform, the compiler has a special macro named _WIN32 defined. So, if the macro _WIN32 is defined, we are on Windows.

What is my current OS?

To find out which Android OS is on your device: Open your device's Settings. Tap About Phone or About Device. Tap Android Version to display your version information.


2 Answers

See the Environment.OSVersion property on MSDN. It is a static property that returns an OperatingSystem object, which has a Version property and you can just check the Major and Minor version numbers to see if it is 6.1 (Windows 7 is actually version 6.1).

    Dim osVer As Version = Environment.OSVersion.Version

    If osVer.Major = 6 And osVer.Minor = 1 Then
        Console.WriteLine("win7!!")
    End If
like image 67
Matt Avatar answered Sep 28 '22 18:09

Matt


I'm guessing since you're a bit new that you're actually using VB.NET rather than classic VB 6.

In VB.NET, you can use:

Dim osVersion As String = System.Environment.OSVersion.ToString()
like image 21
Justin Niessner Avatar answered Sep 28 '22 18:09

Justin Niessner