Operating System Information | VB.NET

The OperatingSystem Class within the .NET Framework offers functionalities to work with operating system information. It includes a method that allows for the creation of a copy of an OperatingSystem instance and another method to retrieve a string representation of the operating system information.

OperatingSystem Class

However, it's important to note that the OperatingSystem class is not intended as a general-purpose class that can be derived from to create more comprehensive types. It is designed to represent basic operating system information and does not support inheritance for creating more inclusive types. If you require a type to store additional information about an operating system, it is recommended to create a custom type and include a field of type OperatingSystem along with any other necessary fields, properties, or methods.

Dim _os As OperatingSystem _os = Environment.OSVersion

To access operating system information and manipulate the current environment and platform, the Environment Class provides a comprehensive set of functionalities. One notable property of the Environment Class is OSVersion, which returns an object of type OperatingSystem. This allows developers to retrieve the operating system information through the Environment.OSVersion property.

The following VB.NET program retrieves the current operating system information like version and platform identifier with the help of OperatingSystem Class and Environment Class.

Full Source VB.NET
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim _os As OperatingSystem _os = Environment.OSVersion MsgBox(_os.VersionString.ToString) End Sub End Class


By using the capabilities of the Environment Class and the OperatingSystem Class, developers can gather information about the current operating system, manipulate the environment, and access basic operating system details. It is important to utilize custom types if more extensive operating system information needs to be stored and additional functionalities beyond the basic representation are required.