mSystemInfo

This is a vb.net module with you can use to retrieve various information about your Operation System it’s not done yet I’m always developing new functions for it in my free time. Here it is

Module mSystemInfo
‘—————————————————————————————
‘ Module : mSystemInfo
‘ DateTime : xx.xx.xx xx:xx
‘ Author : Kreshnik Hasanaj
‘ Mail : kresha7@hotmail.com
‘ Usage : At your own risk.
‘ Purpose : Get System Information
‘ Distribution: You can freely use this code in your own
‘ applications, but you may not reproduce
‘ or publish this code on any web site,
‘ online service, or distribute as source
‘ on any media without express permission.
‘—————————————————————————————
Public Function GetUpTime() As String
Dim i As String
i = InStrRev(My.Computer.Clock.TickCount.ToString / (1000 * 60).ToString, “.”)
GetUpTime = Left$(My.Computer.Clock.TickCount.ToString / (1000 * 60).ToString, System.Convert.ToInt32(i) – 1).ToString & ” Minutes”
End Function

Public Function GetWindows() As String
GetWindows = “”
Try
Dim ServicePack As String = My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion”, “CSDVersion”, Nothing)
GetWindows = My.Computer.Info.OSFullName & ” ” & ServicePack & ” v” & My.Computer.Info.OSVersion
Catch ex As Exception

MsgBox(ex.Message)
End Try

End Function

Public Function ProcessorFamily() As String
ProcessorFamily = “”
Try
ProcessorFamily = My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor”, “Identifier”, Nothing).ToString
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

Public Function FStProcessor() As String
FStProcessor = “”
Try
FStProcessor = Trim(My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor”, “ProcessorNameString”, Nothing))
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

Public Function MashineGuid() As String
MashineGuid = “”
Try
MashineGuid = Trim(My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography”, “MachineGuid”, Nothing))
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

Public Function WindowsProductID() As String
WindowsProductID = “”
Try
WindowsProductID = My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion”, “ProductId”, Nothing)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

Public Function Username() As String
Username = Environ$(“USERNAME”)
End Function

Public Function UserProfPath() As String
UserProfPath = Environ$(“USERPROFILE”)
End Function

Public Function ProcessorArch() As String
ProcessorArch = Environ$(“PROCESSOR_ARCHITECTURE”)
End Function

Public Function LogOnServer() As String
LogOnServer = Environ$(“LOGONSERVER”)
End Function

Public Function CurrentAntiVirus() As String
CurrentAntiVirus = “”
Try
Dim colItems As Object
Dim objItem As Object
Dim objWMIService As Object
Dim OutStr As String
OutStr = “”
objWMIService = GetObject(“winmgmts:\\.\root\SecurityCenter”)
colItems = objWMIService.ExecQuery(“Select * from AntiVirusProduct”)
For Each objItem In colItems
OutStr = objItem.DisplayName
Next
CurrentAntiVirus = OutStr
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Function

Public Function IsAdmin() As Boolean
IsAdmin = My.User.IsAuthenticated
End Function

Public Function RAMMemory() As String
RAMMemory = Decimal.Round(My.Computer.Info.TotalPhysicalMemory / (1024 * 1024)).ToString & “MB”

End Function

Public Function NetworkAvaible() As Boolean
NetworkAvaible = CBool(My.Computer.Network.IsAvailable)
End Function

Public Function GetProxySettings() As String
Dim RegKey As String
GetProxySettings = “”
Try
RegKey = My.Computer.Registry.GetValue(“HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings”, “ProxyServer”, Nothing)
RegKey = Replace(RegKey, “;”, vbNewLine)
GetProxySettings = RegKey
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Function

Public Function IsProxyEnabled() As Boolean
Dim RegKey As String
IsProxyEnabled = “”
Try
RegKey = My.Computer.Registry.GetValue(“HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings”, “ProxyEnable”, Nothing)
IsProxyEnabled = CBool(RegKey)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

Public Function InetUserAgent() As String
Dim RegKey As String
InetUserAgent = “”
Try
RegKey = My.Computer.Registry.GetValue(“HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings”, “User Agent”, Nothing)
InetUserAgent = RegKey
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

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