System information Learn programming Visual Basic (VB.net)

Lesson:

Additional Libraries


Exercise:

System information 11


Objetive:

Create a program that shows certain details of the system: computer name, domain name and user name logged in the system.


Code:

Imports System

Class SystemInformation
    Private Shared Sub Main(ByVal args As String())
        Dim machineName As String = Environment.MachineName
        Dim domainName As String = Environment.UserDomainName
        Dim userName As String = Environment.UserName
        Console.WriteLine("Machine name: {0}", machineName)
        Console.WriteLine("Domain name: {0}", domainName)
        Console.WriteLine("User name: {0}", userName)
    End Sub
End Class