READING SYSTEM PROPERTIES USING VB.NET

Hi fellows, this is a simple way of retrieving system properties through your vb.net application. For example how to know the system owner, the operating system version, the processor information, etc

Below is the code which is handled by a form_load event

Don’t forget this import; Imports Microsoft.Win32

Try

            Dim info As String = “”

            Dim oReg As RegistryKey

            oReg = Registry.LocalMachine.OpenSubKey(“SOFTWARE\Microsoft\Windows NT\CurrentVersion”)

            info = info & ” OS Version:  ” & oReg.GetValue(“CSDVersion”, “DEFAULT-VALUE”).ToString & vbCrLf

            info = info & ” System User:  ” & oReg.GetValue(“RegisteredOwner”, “DEFAULT-VALUE”).ToString & vbCrLf

 

            Dim Str As String = “Hardware\DESCRIPTION\System\CentralProcessor”

            Dim Stride As String = “Identifier”

            Dim strspeed As String = “~MHz”

            Dim strvendor As String = “VendorIdentifier”

            info = info & ” Processor Speed:  ” & Registry.LocalMachine.OpenSubKey(Str.ToString).GetValue(strspeed.ToString) & ” MHz” & vbCrLf

 

            info = info & ” Processor Vendor:  ” & Registry.LocalMachine.OpenSubKey(Str.ToString).GetValue(strvendor.ToString) & vbCrLf

            info = info & ” Processor Identifier:  ” & Registry.LocalMachine.OpenSubKey(Str.ToString).GetValue(Stride.ToString) & vbCrLf

            oReg.Close()

            Me.Label1.Text = info

        Catch ex As Exception

        End Try

 

Below is a picture after runing the application

sys info

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s