معرفة اصدار نظام التشغيل
MessageBox.Show("OS Version: " + Environment.OSVersion.ToString, "Operating System", MessageBoxButtons.OK, MessageBoxIcon.Information)
معرفة الزمن المستغرق منذ تشغيل الكمبيوتر أو اللابتوب
MsgBox(My.Computer.Clock.TickCount)
معرفة اسم الويندوز
Public Function GetWinName() As String
Dim a As String
a = My.Computer.Info.OSFullName
GetWinName = a
End Function
معرفة مسار النظام
Public Function SystemDir() As String
Dim a As String
a = System.Environment.GetFolderPath(Environment.SpecialFolder.System)
SystemDir = a
End Function
معرفة اسم المستخدم
Public Function UserName() As String
Dim a As String
a = System.Environment.UserName
UserName = a
End Function
معرفة المسار الحالى
Public Function CurrentDirectory() As String
Dim a As String
a = System.Environment.CurrentDirectory
CurrentDirectory = a
End Function
أخذ اسم الشركة
Public Function Org() As String
Dim a As String
a = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "Error")
Return a
End Function
أخذ اسم المالك
Public Function OwnerPC() As String
Dim a As String
a = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", "Error")
Return a
End Function
أخذ عدد المعالجات فى هذا الجهاز
MsgBox(System.Environment.ProcessorCount)
أخذ مساحة الذاكرة الظاهرية
MsgBox(My.Computer.Info.TotalPhysicalMemory)
معرفة إذا كان زر Caps Lock يعمل أم لا ؟
MsgBox(My.Computer.Keyboard.CapsLock)
معرفة اذا كان زر Scroll Lock يعمل أم لا ؟
MsgBox(My.Computer.Keyboard.ScrollLock)
معرفة اصدار نظام التشغيل
Public Function GetWinVer() As String
Dim a As String
a = My.Computer.Info.OSVersion
GetWinVer = a
End Function
أخذ الاستخدام الكلى للبرنامج من الذاكرة
MsgBox(System.Environment.WorkingSet)
كلاس كامل لإدارة التطبيقات المنصبة أو المثبتة على الجهاز
Imports System.Management
Public Class ProductManager
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = "localhost"
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim oqj As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_Product")
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(mss, oqj)
Dim queryCollection As ManagementObjectCollection = mos.Get
Public Function GetName() As System.Collections.ObjectModel.Collection(Of String)
GetName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
GetName.Add(getnow.Item("Caption"))
Next
End Function
Public Function Description() As System.Collections.ObjectModel.Collection(Of String)
Description = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Description.Add(getnow.Item("Description"))
Next
End Function
Public Function IdentifyingNumber() As System.Collections.ObjectModel.Collection(Of String)
IdentifyingNumber = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
IdentifyingNumber.Add(getnow.Item("IdentifyingNumber"))
Next
End Function
Public Function PackageCache() As System.Collections.ObjectModel.Collection(Of String)
PackageCache = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PackageCache.Add(getnow.Item("PackageCache"))
Next
End Function
Public Function InstallLocation() As System.Collections.ObjectModel.Collection(Of String)
InstallLocation = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
InstallLocation.Add(getnow.Item("InstallLocation"))
Next
End Function
Public Function Version() As System.Collections.ObjectModel.Collection(Of String)
Version = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Version.Add(getnow.Item("Version"))
Next
End Function
Public Function InstallState() As System.Collections.ObjectModel.Collection(Of String)
InstallState = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
InstallState.Add(getnow.Item("InstallState"))
Next
End Function
Public Function Vendor() As System.Collections.ObjectModel.Collection(Of String)
Vendor = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Vendor.Add(getnow.Item("Vendor"))
Next
End Function
End Class
أخذ مساحة الذاكرة الفارغة بالميجابايت
Dim perfFreeMemory As New PerformanceCounter("Memory", _
"Available MBytes")
MessageBox.Show("There are " & perfFreeMemory.NextValue & _
"MB of memory available on your system. This program requires more.")
أخذ الطابعات الموجودة فى الجهاز
Dim a As New PrintDialog
Dim ar As String
For Each ar In a.PrinterSettings.InstalledPrinters
MsgBox(ar)
Next
التحقق من وجود طابعة
Dim a As New PrintDialog
If a.PrinterSettings.InstalledPrinters.Count = 0 Then
MsgBox("لا يوجد طابعة")
Else
MsgBox("يوجد طابعة")
End If
معرفة اسم الجهاز
Public Function MachineName() As String
Dim a As String
a = System.Environment.MachineName
MachineName = a
End Function
معرفة User Domain Name
Public Function UserDomainName() As String
Dim a As String
a = System.Environment.UserDomainName
UserDomainName = a
End Function
كلاس كامل لإدارة المستخدمين
Public Class CurrentUsers
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_UserAccount")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Name() As System.Collections.ObjectModel.Collection(Of String)
Name = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Name.Add(getnow.Item("Name"))
Next
End Function
Public Function Description() As System.Collections.ObjectModel.Collection(Of String)
Description = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Description.Add(getnow.Item("Description"))
Next
End Function
Public Function LocalAccount() As System.Collections.ObjectModel.Collection(Of String)
LocalAccount = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
LocalAccount.Add(getnow.Item("LocalAccount"))
Next
End Function
Public Function SID() As System.Collections.ObjectModel.Collection(Of String)
SID = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
SID.Add(getnow.Item("SID"))
Next
End Function
Public Function Lockout() As System.Collections.ObjectModel.Collection(Of String)
Lockout = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Lockout = getnow.Item("Lockout")
Next
End Function
Public Function PasswordRequired() As System.Collections.ObjectModel.Collection(Of String)
PasswordRequired = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordRequired.Add(getnow.Item("PasswordRequired"))
Next
End Function
Public Function PasswordExpires() As System.Collections.ObjectModel.Collection(Of String)
PasswordExpires = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordExpires.Add(getnow.Item("PasswordExpires"))
Next
End Function
Public Function PasswordChangeable() As System.Collections.ObjectModel.Collection(Of String)
PasswordChangeable = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordChangeable.Add(getnow.Item("PasswordChangeable"))
Next
End Function
Public Function Disabled() As System.Collections.ObjectModel.Collection(Of String)
Disabled = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Disabled.Add(getnow.Item("Disabled"))
Next
End Function
End Class
أخذ المساحة الفارغة من الذاكرة الظاهرية
MsgBox(My.Computer.Info.AvailablePhysicalMemory)
معرفة إذا كان زر كنترول مضغوط أم لا ؟ Ctrl
MsgBox(My.Computer.Keyboard.CtrlKeyDown)
معرفة إذا كان زر NumLock مضغوط أم لا ؟
MsgBox(My.Computer.Keyboard.NumLock)
أخذ أبعاد الشاشة
MsgBox(My.Computer.Screen.WorkingArea.ToString)
أخذ أسماء البلدان
Dim Col As System.Globalization.CultureInfo
For Each Col In My.Application.UICulture.GetCultures(Globalization.CultureTypes.AllCultures)
ComboBox1.Items.Add(Col.EnglishName)
Next
أخذ العمليات الحالية
Dim a As Process
For Each a In Process.GetProcesses
MsgBox(a.ProcessName)
Next
أخذ الخدمات الحالية
Dim Ser As System.ServiceProcess.ServiceController
For Each Ser In System.ServiceProcess.ServiceController.GetServices
ComboBox1.Items.Add(Ser.ServiceName)
Next
أخذ معلومات كاملة عن النظام
'أستخدم اللأسم SystemInformation
'لأخذ معومات كاملة عن النظام مثال
MsgBox(SystemInformation.KeyboardSpeed)
كلاس عن طريق (Wmi) Operating System
Public Class OperatingSystem
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM win32_operatingsystem")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function BuildType()
For Each getnow As ManagementObject In queryCollection
BuildType = getnow("BuildType")
Next
End Function
Public Function CountryCode()
For Each getnow As ManagementObject In queryCollection
CountryCode = getnow("CountryCode")
Next
End Function
Public Function CSDVersion()
For Each getnow As ManagementObject In queryCollection
CSDVersion = getnow("CSDVersion")
Next
End Function
Public Function CSName()
For Each getnow As ManagementObject In queryCollection
CSName = getnow("CSName")
Next
End Function
Public Function CurrentTimeZone()
For Each getnow As ManagementObject In queryCollection
CurrentTimeZone = getnow("CurrentTimeZone")
Next
End Function
Public Function FreePhysicalMemory()
For Each getnow As ManagementObject In queryCollection
FreePhysicalMemory = getnow("FreePhysicalMemory")
Next
End Function
Public Function FreeSpaceInPagingFiles()
For Each getnow As ManagementObject In queryCollection
FreeSpaceInPagingFiles = getnow("FreeSpaceInPagingFiles")
Next
End Function
Public Function InstallDate()
For Each getnow As ManagementObject In queryCollection
InstallDate = getnow("InstallDate")
Next
End Function
Public Function LargeSystemCache()
For Each getnow As ManagementObject In queryCollection
LargeSystemCache = getnow("LargeSystemCache")
Next
End Function
Public Function LastBootUpTime()
For Each getnow As ManagementObject In queryCollection
LastBootUpTime = getnow("LastBootUpTime")
Next
End Function
Public Function Manufacturer()
For Each getnow As ManagementObject In queryCollection
Manufacturer = getnow("Manufacturer")
Next
End Function
Public Function NumberOfUsers()
For Each getnow As ManagementObject In queryCollection
NumberOfUsers = getnow("NumberOfUsers")
Next
End Function
Public Function Organization()
For Each getnow As ManagementObject In queryCollection
Organization = getnow("Organization")
Next
End Function
Public Function SerialNumber()
For Each getnow As ManagementObject In queryCollection
SerialNumber = getnow("SerialNumber")
Next
End Function
Public Function ServicePackMajorVersion()
For Each getnow As ManagementObject In queryCollection
ServicePackMajorVersion = getnow("ServicePackMajorVersion")
Next
End Function
Public Function ServicePackMinorVersion()
For Each getnow As ManagementObject In queryCollection
ServicePackMinorVersion = getnow("ServicePackMinorVersion")
Next
End Function
Public Function Version()
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version")
Next
End Function
Public Function TotalVirtualMemorySize()
For Each getnow As ManagementObject In queryCollection
TotalVirtualMemorySize = getnow("TotalVirtualMemorySize")
Next
End Function
Public Function TotalVisibleMemorySize()
For Each getnow As ManagementObject In queryCollection
TotalVisibleMemorySize = getnow("TotalVisibleMemorySize")
Next
End Function
Public Function RegisteredUser()
For Each getnow As ManagementObject In queryCollection
RegisteredUser = getnow("RegisteredUser")
Next
End Function
End Class
كلاس كامل لأخذ معلومات عن الجهاز
Imports System.Management
Imports System.Net
Public Class SystemInfo
Public Class BaseBoard
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM win32_BaseBoard")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function Manufacturer()
For Each getnow As ManagementObject In queryCollection
Manufacturer = getnow("Manufacturer")
Next
End Function
Public Function Version()
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version")
Next
End Function
Public Function HostingBoard()
For Each getnow As ManagementObject In queryCollection
HostingBoard = getnow("HostingBoard")
Next
End Function
Public Function Product()
For Each getnow As ManagementObject In queryCollection
Product = getnow("Product")
Next
End Function
Public Function SerialNumber()
For Each getnow As ManagementObject In queryCollection
SerialNumber = getnow("SerialNumber")
Next
End Function
Public Function PoweredOn()
For Each getnow As ManagementObject In queryCollection
PoweredOn = getnow("PoweredOn")
Next
End Function
End Class
Public Class bios
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_bios")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Names()
For Each getnow As ManagementObject In queryCollection
Names = getnow("name")
Next
End Function
Public Function status()
For Each getnow As ManagementObject In queryCollection
status = getnow("")
Next
End Function
Public Function BiosCharacteristics()
For Each getnow As ManagementObject In queryCollection
BiosCharacteristics = getnow("BiosCharacteristics")
Next
End Function
Public Function BIOSVersion()
For Each getnow As ManagementObject In queryCollection
BIOSVersion = getnow("BIOSVersion")
Next
End Function
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function CurrentLanguage()
For Each getnow As ManagementObject In queryCollection
CurrentLanguage = getnow("CurrentLanguage")
Next
End Function
Public Function Description()
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description")
Next
End Function
Public Function InstallableLanguages()
For Each getnow As ManagementObject In queryCollection
InstallableLanguages = getnow("InstallableLanguages")
Next
End Function
Public Function ListOfLanguages()
For Each getnow As ManagementObject In queryCollection
ListOfLanguages = getnow("ListOfLanguages")
Next
End Function
Public Function PrimaryBIOS()
For Each getnow As ManagementObject In queryCollection
PrimaryBIOS = getnow("PrimaryBIOS")
Next
End Function
Public Function ReleaseDate()
For Each getnow As ManagementObject In queryCollection
ReleaseDate = getnow("ReleaseDate")
Next
End Function
Public Function SMBIOSBIOSVersion()
For Each getnow As ManagementObject In queryCollection
SMBIOSBIOSVersion = getnow("SMBIOSBIOSVersion")
Next
End Function
Public Function SMBIOSMajorVersion()
For Each getnow As ManagementObject In queryCollection
SMBIOSMajorVersion = getnow("SMBIOSMajorVersion")
Next
End Function
Public Function SMBIOSMinorVersion()
For Each getnow As ManagementObject In queryCollection
SMBIOSMinorVersion = getnow("SMBIOSMinorVersion")
Next
End Function
Public Function SMBIOSPresent()
For Each getnow As ManagementObject In queryCollection
SMBIOSPresent = getnow("SMBIOSPresent")
Next
End Function
Public Function TargetOperatingSystem()
For Each getnow As ManagementObject In queryCollection
TargetOperatingSystem = getnow("TargetOperatingSystem")
Next
End Function
Public Function Version()
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version")
Next
End Function
End Class
Public Class CD_ROM
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_cdromdrive")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function CdRomName() As System.Collections.ObjectModel.Collection(Of String)
CdRomName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
CdRomName.Add(getnow("name"))
Next
End Function
Public Function CdRomManufacturer() As System.Collections.ObjectModel.Collection(Of String)
CdRomManufacturer = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
CdRomManufacturer.Add(getnow("Manufacturer"))
Next
End Function
Public Function Availability() As System.Collections.ObjectModel.Collection(Of String)
Availability = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Availability.Add(getnow("Availability"))
Next
End Function
Public Function Caption() As System.Collections.ObjectModel.Collection(Of String)
Caption = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Caption.Add(getnow("Caption"))
Next
End Function
Public Function ConfigManagerErrorCode() As System.Collections.ObjectModel.Collection(Of String)
ConfigManagerErrorCode = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
ConfigManagerErrorCode.Add(getnow("ConfigManagerErrorCode"))
Next
End Function
Public Function Drive() As System.Collections.ObjectModel.Collection(Of String)
Drive = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Drive.Add(getnow("Drive"))
Next
End Function
Public Function MediaType() As System.Collections.ObjectModel.Collection(Of String)
MediaType = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
MediaType.Add(getnow("MediaType"))
Next
End Function
Public Function MediaLoaded() As System.Collections.ObjectModel.Collection(Of String)
MediaLoaded = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
MediaLoaded.Add(getnow("MediaLoaded"))
Next
End Function
End Class
Public Class Com
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_SerialPort")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function PortUse() As System.Collections.ObjectModel.Collection(Of String)
PortUse = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PortUse.Add(getnow("name"))
Next
End Function
Public Function OnPort() As System.Collections.ObjectModel.Collection(Of String)
OnPort = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
OnPort.Add(getnow("deviceid"))
Next
End Function
Public Function MaxBaudRate() As System.Collections.ObjectModel.Collection(Of String)
MaxBaudRate = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
MaxBaudRate.Add(getnow("MaxBaudRate"))
Next
End Function
End Class
Public Class Computersystem
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_ComputerSystem")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function AdminPasswordStatus()
For Each getnow As ManagementObject In queryCollection
AdminPasswordStatus = getnow("AdminPasswordStatus").ToString
Next
End Function
Public Function AutomaticResetBootOption()
For Each getnow As ManagementObject In queryCollection
AutomaticResetBootOption = getnow("AutomaticResetBootOption").ToString
Next
End Function
Public Function AutomaticResetCapability()
For Each getnow As ManagementObject In queryCollection
AutomaticResetCapability = getnow("AutomaticResetCapability").ToString
Next
End Function
Public Function BootupState()
For Each getnow As ManagementObject In queryCollection
BootupState = getnow("BootupState").ToString
Next
End Function
Public Function CurrentTimeZone()
For Each getnow As ManagementObject In queryCollection
CurrentTimeZone = getnow("CurrentTimeZone").ToString
Next
End Function
Public Function Description()
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description").ToString
Next
End Function
Public Function Domain()
For Each getnow As ManagementObject In queryCollection
Domain = getnow("Domain").ToString
Next
End Function
Public Function KeyboardPasswordStatus()
For Each getnow As ManagementObject In queryCollection
KeyboardPasswordStatus = getnow("KeyboardPasswordStatus").ToString
Next
End Function
Public Function Model()
For Each getnow As ManagementObject In queryCollection
Model = getnow("Model").ToString
Next
End Function
Public Function PowerState()
For Each getnow As ManagementObject In queryCollection
PowerState = getnow("PowerState").ToString
Next
End Function
Public Function Roles()
For Each getnow As ManagementObject In queryCollection
Roles = getnow("Roles").ToString
Next
End Function
Public Function SystemType()
For Each getnow As ManagementObject In queryCollection
SystemType = getnow("SystemType").ToString
Next
End Function
End Class
Public Class CPU
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim oqj As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_processor")
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(mss, oqj)
Dim queryCollection As ManagementObjectCollection = mos.Get
Public Function GetName()
For Each getnow As ManagementObject In queryCollection
GetName = getnow("name").ToString
Next
End Function
Public Function GetCaption() As String
For Each getnow As ManagementObject In queryCollection
GetCaption = getnow("Caption").ToString
Next
End Function
Public Function GetManufacturer() As String
For Each getnow As ManagementObject In queryCollection
GetManufacturer = getnow("Manufacturer").ToString
Next
End Function
Public Function GetSpeed() As String
For Each getnow As ManagementObject In queryCollection
GetSpeed = getnow("MaxClockSpeed").ToString
Next
End Function
Public Function GetL2CacheSize() As String
For Each getnow As ManagementObject In queryCollection
GetL2CacheSize = getnow("L2CacheSize").ToString
Next
End Function
Public Function SocketDesignation() As String
For Each getnow As ManagementObject In queryCollection
SocketDesignation = getnow("SocketDesignation").ToString
Next
End Function
Public Function ProcessorId() As String
For Each getnow As ManagementObject In queryCollection
ProcessorId = getnow("ProcessorId").ToString
Next
End Function
Public Function ExtClock() As String
For Each getnow As ManagementObject In queryCollection
ExtClock = getnow("ExtClock").ToString
Next
End Function
Public Function CurrentVoltage() As String
For Each getnow As ManagementObject In queryCollection
CurrentVoltage = getnow("CurrentVoltage").ToString
Next
End Function
Public Function Stepping() As String
For Each getnow As ManagementObject In queryCollection
Stepping = getnow("Stepping").ToString
Next
End Function
Public Function Level() As String
For Each getnow As ManagementObject In queryCollection
Level = getnow("Level").ToString
Next
End Function
Public Function Revision() As String
For Each getnow As ManagementObject In queryCollection
Revision = getnow("Revision").ToString
Next
End Function
Public Function Version() As String
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version").ToString
Next
End Function
End Class
Public Class CurrentUsers
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_UserAccount")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Name() As System.Collections.ObjectModel.Collection(Of String)
Name = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Name.Add(getnow.Item("Name"))
Next
End Function
Public Function Description() As System.Collections.ObjectModel.Collection(Of String)
Description = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Description.Add(getnow.Item("Description"))
Next
End Function
Public Function LocalAccount() As System.Collections.ObjectModel.Collection(Of String)
LocalAccount = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
LocalAccount.Add(getnow.Item("LocalAccount"))
Next
End Function
Public Function SID() As System.Collections.ObjectModel.Collection(Of String)
SID = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
SID.Add(getnow.Item("SID"))
Next
End Function
Public Function Lockout() As System.Collections.ObjectModel.Collection(Of String)
Lockout = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Lockout = getnow.Item("Lockout")
Next
End Function
Public Function PasswordRequired() As System.Collections.ObjectModel.Collection(Of String)
PasswordRequired = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordRequired.Add(getnow.Item("PasswordRequired"))
Next
End Function
Public Function PasswordExpires() As System.Collections.ObjectModel.Collection(Of String)
PasswordExpires = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordExpires.Add(getnow.Item("PasswordExpires"))
Next
End Function
Public Function PasswordChangeable() As System.Collections.ObjectModel.Collection(Of String)
PasswordChangeable = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordChangeable.Add(getnow.Item("PasswordChangeable"))
Next
End Function
Public Function Disabled() As System.Collections.ObjectModel.Collection(Of String)
Disabled = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Disabled.Add(getnow.Item("Disabled"))
Next
End Function
End Class
Public Class Floppy
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_FloppyDrive")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function FloppyName() As System.Collections.ObjectModel.Collection(Of String)
FloppyName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
FloppyName.Add(getnow("name"))
Next
End Function
Public Function FloppyManufacturer() As System.Collections.ObjectModel.Collection(Of String)
FloppyManufacturer = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
FloppyManufacturer.Add(getnow("Manufacturer"))
Next
End Function
End Class
Public Class HardDesk
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_diskdrive")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function GetName() As String
For Each getnow As ManagementObject In queryCollection
GetName = getnow("Caption").ToString
Next
End Function
Public Function GetSize() As String
For Each getnow As ManagementObject In queryCollection
GetSize = getnow("size")
Next
End Function
Public Function GetManufacturer() As String
For Each getnow As ManagementObject In queryCollection
GetManufacturer = getnow("Manufacturer").ToString
Next
End Function
Public Function GetSerial() As String
Dim HDinformation As New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
Dim HD As ManagementObject
For Each HD In HDinformation.Get()
GetSerial = HD("SerialNumber").ToString()
Next
End Function
Public Function BytesPerSector() As String
For Each getnow As ManagementObject In queryCollection
BytesPerSector = getnow("BytesPerSector").ToString
Next
End Function
Public Function Description() As String
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description").ToString
Next
End Function
Public Function MediaType() As String
For Each getnow As ManagementObject In queryCollection
MediaType = getnow("MediaType").ToString
Next
End Function
Public Function Model() As String
For Each getnow As ManagementObject In queryCollection
Model = getnow("Model").ToString
Next
End Function
Public Function TotalCylinders() As String
For Each getnow As ManagementObject In queryCollection
TotalCylinders = getnow("TotalCylinders").ToString
Next
End Function
Public Function TotalSectors() As String
For Each getnow As ManagementObject In queryCollection
TotalSectors = getnow("TotalSectors").ToString
Next
End Function
Public Function TotalHeads() As String
For Each getnow As ManagementObject In queryCollection
TotalHeads = getnow("TotalHeads").ToString
Next
End Function
Public Function TotalTracks() As String
For Each getnow As ManagementObject In queryCollection
TotalTracks = getnow("TotalTracks").ToString
Next
End Function
End Class
Public Class keyboard
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_keyboard")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function KetBName()
For Each getnow As ManagementObject In queryCollection
KetBName = getnow("name")
Next
End Function
Public Function KetBstatus()
For Each getnow As ManagementObject In queryCollection
KetBstatus = getnow("status")
Next
End Function
Public Function KetBDeviceID()
For Each getnow As ManagementObject In queryCollection
KetBDeviceID = getnow("DeviceID")
Next
End Function
Public Function Description()
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description")
Next
End Function
End Class
Public Class LogicalDisk
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim oqj As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_LogicalDisk")
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(mss, oqj)
Dim queryCollection As ManagementObjectCollection = mos.Get
Public Function DiskCaption() As System.Collections.ObjectModel.Collection(Of String)
DiskCaption = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskCaption.Add(getnow("caption"))
Next
End Function
Public Function DiskDeviceID() As System.Collections.ObjectModel.Collection(Of String)
DiskDeviceID = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskDeviceID.Add(getnow("DeviceID"))
Next
End Function
Public Function DiskDriveType() As System.Collections.ObjectModel.Collection(Of String)
DiskDriveType = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskDriveType.Add(getnow("DriveType").ToString)
Next
End Function
Public Function DiskFileSystem() As System.Collections.ObjectModel.Collection(Of String)
DiskFileSystem = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskFileSystem.Add(getnow("FileSystem"))
Next
End Function
Public Function DiskFreeSpace() As System.Collections.ObjectModel.Collection(Of String)
DiskFreeSpace = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskFreeSpace.Add(getnow("FreeSpace"))
Next
End Function
Public Function DiskMediaType() As System.Collections.ObjectModel.Collection(Of String)
DiskMediaType = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskMediaType.Add(getnow("MediaType").ToString)
Next
End Function
Public Function DiskSize() As System.Collections.ObjectModel.Collection(Of String)
DiskSize = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskSize.Add(getnow("Size"))
Next
End Function
Public Function DiskVolumeName() As System.Collections.ObjectModel.Collection(Of String)
DiskVolumeName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskVolumeName.Add(getnow("VolumeName"))
Next
End Function
Public Function DiskVolumeSerialNumber() As System.Collections.ObjectModel.Collection(Of String)
DiskVolumeSerialNumber = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskVolumeSerialNumber.Add(getnow("VolumeSerialNumber"))
Next
End Function
End Class
Public Class Memory
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_physicalmemory")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Names()
For Each getnow As ManagementObject In queryCollection
Names = getnow("name")
Next
End Function
Public Function Capacity()
For Each getnow As ManagementObject In queryCollection
Capacity = getnow("Capacity")
Next
End Function
Public Function DeviceLocator()
For Each getnow As ManagementObject In queryCollection
DeviceLocator = getnow("DeviceLocator")
Next
End Function
Public Function TotalWidth()
For Each getnow As ManagementObject In queryCollection
TotalWidth = getnow("TotalWidth")
Next
End Function
End Class
Public Class Monitor
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_DesktopMonitor")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function DeviceID()
For Each getnow As ManagementObject In queryCollection
DeviceID = getnow("DeviceID")
Next
End Function
Public Function MonitorManufacturer()
For Each getnow As ManagementObject In queryCollection
MonitorManufacturer = getnow("MonitorManufacturer")
Next
End Function
Public Function ScreenHeight()
For Each getnow As ManagementObject In queryCollection
ScreenHeight = getnow("ScreenHeight")
Next
End Function
Please SUBSCRIBE to get new articles directly into your Email inbox!
MessageBox.Show("OS Version: " + Environment.OSVersion.ToString, "Operating System", MessageBoxButtons.OK, MessageBoxIcon.Information)
معرفة الزمن المستغرق منذ تشغيل الكمبيوتر أو اللابتوب
MsgBox(My.Computer.Clock.TickCount)
معرفة اسم الويندوز
Public Function GetWinName() As String
Dim a As String
a = My.Computer.Info.OSFullName
GetWinName = a
End Function
معرفة مسار النظام
Public Function SystemDir() As String
Dim a As String
a = System.Environment.GetFolderPath(Environment.SpecialFolder.System)
SystemDir = a
End Function
معرفة اسم المستخدم
Public Function UserName() As String
Dim a As String
a = System.Environment.UserName
UserName = a
End Function
معرفة المسار الحالى
Public Function CurrentDirectory() As String
Dim a As String
a = System.Environment.CurrentDirectory
CurrentDirectory = a
End Function
أخذ اسم الشركة
Public Function Org() As String
Dim a As String
a = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "Error")
Return a
End Function
أخذ اسم المالك
Public Function OwnerPC() As String
Dim a As String
a = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", "Error")
Return a
End Function
أخذ عدد المعالجات فى هذا الجهاز
MsgBox(System.Environment.ProcessorCount)
أخذ مساحة الذاكرة الظاهرية
MsgBox(My.Computer.Info.TotalPhysicalMemory)
معرفة إذا كان زر Caps Lock يعمل أم لا ؟
MsgBox(My.Computer.Keyboard.CapsLock)
معرفة اذا كان زر Scroll Lock يعمل أم لا ؟
MsgBox(My.Computer.Keyboard.ScrollLock)
معرفة اصدار نظام التشغيل
Public Function GetWinVer() As String
Dim a As String
a = My.Computer.Info.OSVersion
GetWinVer = a
End Function
أخذ الاستخدام الكلى للبرنامج من الذاكرة
MsgBox(System.Environment.WorkingSet)
كلاس كامل لإدارة التطبيقات المنصبة أو المثبتة على الجهاز
Imports System.Management
Public Class ProductManager
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = "localhost"
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim oqj As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_Product")
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(mss, oqj)
Dim queryCollection As ManagementObjectCollection = mos.Get
Public Function GetName() As System.Collections.ObjectModel.Collection(Of String)
GetName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
GetName.Add(getnow.Item("Caption"))
Next
End Function
Public Function Description() As System.Collections.ObjectModel.Collection(Of String)
Description = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Description.Add(getnow.Item("Description"))
Next
End Function
Public Function IdentifyingNumber() As System.Collections.ObjectModel.Collection(Of String)
IdentifyingNumber = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
IdentifyingNumber.Add(getnow.Item("IdentifyingNumber"))
Next
End Function
Public Function PackageCache() As System.Collections.ObjectModel.Collection(Of String)
PackageCache = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PackageCache.Add(getnow.Item("PackageCache"))
Next
End Function
Public Function InstallLocation() As System.Collections.ObjectModel.Collection(Of String)
InstallLocation = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
InstallLocation.Add(getnow.Item("InstallLocation"))
Next
End Function
Public Function Version() As System.Collections.ObjectModel.Collection(Of String)
Version = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Version.Add(getnow.Item("Version"))
Next
End Function
Public Function InstallState() As System.Collections.ObjectModel.Collection(Of String)
InstallState = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
InstallState.Add(getnow.Item("InstallState"))
Next
End Function
Public Function Vendor() As System.Collections.ObjectModel.Collection(Of String)
Vendor = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Vendor.Add(getnow.Item("Vendor"))
Next
End Function
End Class
أخذ مساحة الذاكرة الفارغة بالميجابايت
Dim perfFreeMemory As New PerformanceCounter("Memory", _
"Available MBytes")
MessageBox.Show("There are " & perfFreeMemory.NextValue & _
"MB of memory available on your system. This program requires more.")
أخذ الطابعات الموجودة فى الجهاز
Dim a As New PrintDialog
Dim ar As String
For Each ar In a.PrinterSettings.InstalledPrinters
MsgBox(ar)
Next
التحقق من وجود طابعة
Dim a As New PrintDialog
If a.PrinterSettings.InstalledPrinters.Count = 0 Then
MsgBox("لا يوجد طابعة")
Else
MsgBox("يوجد طابعة")
End If
معرفة اسم الجهاز
Public Function MachineName() As String
Dim a As String
a = System.Environment.MachineName
MachineName = a
End Function
معرفة User Domain Name
Public Function UserDomainName() As String
Dim a As String
a = System.Environment.UserDomainName
UserDomainName = a
End Function
كلاس كامل لإدارة المستخدمين
Public Class CurrentUsers
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_UserAccount")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Name() As System.Collections.ObjectModel.Collection(Of String)
Name = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Name.Add(getnow.Item("Name"))
Next
End Function
Public Function Description() As System.Collections.ObjectModel.Collection(Of String)
Description = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Description.Add(getnow.Item("Description"))
Next
End Function
Public Function LocalAccount() As System.Collections.ObjectModel.Collection(Of String)
LocalAccount = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
LocalAccount.Add(getnow.Item("LocalAccount"))
Next
End Function
Public Function SID() As System.Collections.ObjectModel.Collection(Of String)
SID = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
SID.Add(getnow.Item("SID"))
Next
End Function
Public Function Lockout() As System.Collections.ObjectModel.Collection(Of String)
Lockout = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Lockout = getnow.Item("Lockout")
Next
End Function
Public Function PasswordRequired() As System.Collections.ObjectModel.Collection(Of String)
PasswordRequired = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordRequired.Add(getnow.Item("PasswordRequired"))
Next
End Function
Public Function PasswordExpires() As System.Collections.ObjectModel.Collection(Of String)
PasswordExpires = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordExpires.Add(getnow.Item("PasswordExpires"))
Next
End Function
Public Function PasswordChangeable() As System.Collections.ObjectModel.Collection(Of String)
PasswordChangeable = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordChangeable.Add(getnow.Item("PasswordChangeable"))
Next
End Function
Public Function Disabled() As System.Collections.ObjectModel.Collection(Of String)
Disabled = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Disabled.Add(getnow.Item("Disabled"))
Next
End Function
End Class
أخذ المساحة الفارغة من الذاكرة الظاهرية
MsgBox(My.Computer.Info.AvailablePhysicalMemory)
معرفة إذا كان زر كنترول مضغوط أم لا ؟ Ctrl
MsgBox(My.Computer.Keyboard.CtrlKeyDown)
معرفة إذا كان زر NumLock مضغوط أم لا ؟
MsgBox(My.Computer.Keyboard.NumLock)
أخذ أبعاد الشاشة
MsgBox(My.Computer.Screen.WorkingArea.ToString)
أخذ أسماء البلدان
Dim Col As System.Globalization.CultureInfo
For Each Col In My.Application.UICulture.GetCultures(Globalization.CultureTypes.AllCultures)
ComboBox1.Items.Add(Col.EnglishName)
Next
أخذ العمليات الحالية
Dim a As Process
For Each a In Process.GetProcesses
MsgBox(a.ProcessName)
Next
أخذ الخدمات الحالية
Dim Ser As System.ServiceProcess.ServiceController
For Each Ser In System.ServiceProcess.ServiceController.GetServices
ComboBox1.Items.Add(Ser.ServiceName)
Next
أخذ معلومات كاملة عن النظام
'أستخدم اللأسم SystemInformation
'لأخذ معومات كاملة عن النظام مثال
MsgBox(SystemInformation.KeyboardSpeed)
كلاس عن طريق (Wmi) Operating System
Public Class OperatingSystem
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM win32_operatingsystem")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function BuildType()
For Each getnow As ManagementObject In queryCollection
BuildType = getnow("BuildType")
Next
End Function
Public Function CountryCode()
For Each getnow As ManagementObject In queryCollection
CountryCode = getnow("CountryCode")
Next
End Function
Public Function CSDVersion()
For Each getnow As ManagementObject In queryCollection
CSDVersion = getnow("CSDVersion")
Next
End Function
Public Function CSName()
For Each getnow As ManagementObject In queryCollection
CSName = getnow("CSName")
Next
End Function
Public Function CurrentTimeZone()
For Each getnow As ManagementObject In queryCollection
CurrentTimeZone = getnow("CurrentTimeZone")
Next
End Function
Public Function FreePhysicalMemory()
For Each getnow As ManagementObject In queryCollection
FreePhysicalMemory = getnow("FreePhysicalMemory")
Next
End Function
Public Function FreeSpaceInPagingFiles()
For Each getnow As ManagementObject In queryCollection
FreeSpaceInPagingFiles = getnow("FreeSpaceInPagingFiles")
Next
End Function
Public Function InstallDate()
For Each getnow As ManagementObject In queryCollection
InstallDate = getnow("InstallDate")
Next
End Function
Public Function LargeSystemCache()
For Each getnow As ManagementObject In queryCollection
LargeSystemCache = getnow("LargeSystemCache")
Next
End Function
Public Function LastBootUpTime()
For Each getnow As ManagementObject In queryCollection
LastBootUpTime = getnow("LastBootUpTime")
Next
End Function
Public Function Manufacturer()
For Each getnow As ManagementObject In queryCollection
Manufacturer = getnow("Manufacturer")
Next
End Function
Public Function NumberOfUsers()
For Each getnow As ManagementObject In queryCollection
NumberOfUsers = getnow("NumberOfUsers")
Next
End Function
Public Function Organization()
For Each getnow As ManagementObject In queryCollection
Organization = getnow("Organization")
Next
End Function
Public Function SerialNumber()
For Each getnow As ManagementObject In queryCollection
SerialNumber = getnow("SerialNumber")
Next
End Function
Public Function ServicePackMajorVersion()
For Each getnow As ManagementObject In queryCollection
ServicePackMajorVersion = getnow("ServicePackMajorVersion")
Next
End Function
Public Function ServicePackMinorVersion()
For Each getnow As ManagementObject In queryCollection
ServicePackMinorVersion = getnow("ServicePackMinorVersion")
Next
End Function
Public Function Version()
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version")
Next
End Function
Public Function TotalVirtualMemorySize()
For Each getnow As ManagementObject In queryCollection
TotalVirtualMemorySize = getnow("TotalVirtualMemorySize")
Next
End Function
Public Function TotalVisibleMemorySize()
For Each getnow As ManagementObject In queryCollection
TotalVisibleMemorySize = getnow("TotalVisibleMemorySize")
Next
End Function
Public Function RegisteredUser()
For Each getnow As ManagementObject In queryCollection
RegisteredUser = getnow("RegisteredUser")
Next
End Function
End Class
كلاس كامل لأخذ معلومات عن الجهاز
Imports System.Management
Imports System.Net
Public Class SystemInfo
Public Class BaseBoard
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM win32_BaseBoard")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function Manufacturer()
For Each getnow As ManagementObject In queryCollection
Manufacturer = getnow("Manufacturer")
Next
End Function
Public Function Version()
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version")
Next
End Function
Public Function HostingBoard()
For Each getnow As ManagementObject In queryCollection
HostingBoard = getnow("HostingBoard")
Next
End Function
Public Function Product()
For Each getnow As ManagementObject In queryCollection
Product = getnow("Product")
Next
End Function
Public Function SerialNumber()
For Each getnow As ManagementObject In queryCollection
SerialNumber = getnow("SerialNumber")
Next
End Function
Public Function PoweredOn()
For Each getnow As ManagementObject In queryCollection
PoweredOn = getnow("PoweredOn")
Next
End Function
End Class
Public Class bios
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_bios")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Names()
For Each getnow As ManagementObject In queryCollection
Names = getnow("name")
Next
End Function
Public Function status()
For Each getnow As ManagementObject In queryCollection
status = getnow("")
Next
End Function
Public Function BiosCharacteristics()
For Each getnow As ManagementObject In queryCollection
BiosCharacteristics = getnow("BiosCharacteristics")
Next
End Function
Public Function BIOSVersion()
For Each getnow As ManagementObject In queryCollection
BIOSVersion = getnow("BIOSVersion")
Next
End Function
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function CurrentLanguage()
For Each getnow As ManagementObject In queryCollection
CurrentLanguage = getnow("CurrentLanguage")
Next
End Function
Public Function Description()
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description")
Next
End Function
Public Function InstallableLanguages()
For Each getnow As ManagementObject In queryCollection
InstallableLanguages = getnow("InstallableLanguages")
Next
End Function
Public Function ListOfLanguages()
For Each getnow As ManagementObject In queryCollection
ListOfLanguages = getnow("ListOfLanguages")
Next
End Function
Public Function PrimaryBIOS()
For Each getnow As ManagementObject In queryCollection
PrimaryBIOS = getnow("PrimaryBIOS")
Next
End Function
Public Function ReleaseDate()
For Each getnow As ManagementObject In queryCollection
ReleaseDate = getnow("ReleaseDate")
Next
End Function
Public Function SMBIOSBIOSVersion()
For Each getnow As ManagementObject In queryCollection
SMBIOSBIOSVersion = getnow("SMBIOSBIOSVersion")
Next
End Function
Public Function SMBIOSMajorVersion()
For Each getnow As ManagementObject In queryCollection
SMBIOSMajorVersion = getnow("SMBIOSMajorVersion")
Next
End Function
Public Function SMBIOSMinorVersion()
For Each getnow As ManagementObject In queryCollection
SMBIOSMinorVersion = getnow("SMBIOSMinorVersion")
Next
End Function
Public Function SMBIOSPresent()
For Each getnow As ManagementObject In queryCollection
SMBIOSPresent = getnow("SMBIOSPresent")
Next
End Function
Public Function TargetOperatingSystem()
For Each getnow As ManagementObject In queryCollection
TargetOperatingSystem = getnow("TargetOperatingSystem")
Next
End Function
Public Function Version()
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version")
Next
End Function
End Class
Public Class CD_ROM
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_cdromdrive")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function CdRomName() As System.Collections.ObjectModel.Collection(Of String)
CdRomName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
CdRomName.Add(getnow("name"))
Next
End Function
Public Function CdRomManufacturer() As System.Collections.ObjectModel.Collection(Of String)
CdRomManufacturer = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
CdRomManufacturer.Add(getnow("Manufacturer"))
Next
End Function
Public Function Availability() As System.Collections.ObjectModel.Collection(Of String)
Availability = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Availability.Add(getnow("Availability"))
Next
End Function
Public Function Caption() As System.Collections.ObjectModel.Collection(Of String)
Caption = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Caption.Add(getnow("Caption"))
Next
End Function
Public Function ConfigManagerErrorCode() As System.Collections.ObjectModel.Collection(Of String)
ConfigManagerErrorCode = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
ConfigManagerErrorCode.Add(getnow("ConfigManagerErrorCode"))
Next
End Function
Public Function Drive() As System.Collections.ObjectModel.Collection(Of String)
Drive = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Drive.Add(getnow("Drive"))
Next
End Function
Public Function MediaType() As System.Collections.ObjectModel.Collection(Of String)
MediaType = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
MediaType.Add(getnow("MediaType"))
Next
End Function
Public Function MediaLoaded() As System.Collections.ObjectModel.Collection(Of String)
MediaLoaded = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
MediaLoaded.Add(getnow("MediaLoaded"))
Next
End Function
End Class
Public Class Com
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_SerialPort")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function PortUse() As System.Collections.ObjectModel.Collection(Of String)
PortUse = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PortUse.Add(getnow("name"))
Next
End Function
Public Function OnPort() As System.Collections.ObjectModel.Collection(Of String)
OnPort = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
OnPort.Add(getnow("deviceid"))
Next
End Function
Public Function MaxBaudRate() As System.Collections.ObjectModel.Collection(Of String)
MaxBaudRate = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
MaxBaudRate.Add(getnow("MaxBaudRate"))
Next
End Function
End Class
Public Class Computersystem
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_ComputerSystem")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function AdminPasswordStatus()
For Each getnow As ManagementObject In queryCollection
AdminPasswordStatus = getnow("AdminPasswordStatus").ToString
Next
End Function
Public Function AutomaticResetBootOption()
For Each getnow As ManagementObject In queryCollection
AutomaticResetBootOption = getnow("AutomaticResetBootOption").ToString
Next
End Function
Public Function AutomaticResetCapability()
For Each getnow As ManagementObject In queryCollection
AutomaticResetCapability = getnow("AutomaticResetCapability").ToString
Next
End Function
Public Function BootupState()
For Each getnow As ManagementObject In queryCollection
BootupState = getnow("BootupState").ToString
Next
End Function
Public Function CurrentTimeZone()
For Each getnow As ManagementObject In queryCollection
CurrentTimeZone = getnow("CurrentTimeZone").ToString
Next
End Function
Public Function Description()
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description").ToString
Next
End Function
Public Function Domain()
For Each getnow As ManagementObject In queryCollection
Domain = getnow("Domain").ToString
Next
End Function
Public Function KeyboardPasswordStatus()
For Each getnow As ManagementObject In queryCollection
KeyboardPasswordStatus = getnow("KeyboardPasswordStatus").ToString
Next
End Function
Public Function Model()
For Each getnow As ManagementObject In queryCollection
Model = getnow("Model").ToString
Next
End Function
Public Function PowerState()
For Each getnow As ManagementObject In queryCollection
PowerState = getnow("PowerState").ToString
Next
End Function
Public Function Roles()
For Each getnow As ManagementObject In queryCollection
Roles = getnow("Roles").ToString
Next
End Function
Public Function SystemType()
For Each getnow As ManagementObject In queryCollection
SystemType = getnow("SystemType").ToString
Next
End Function
End Class
Public Class CPU
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim oqj As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_processor")
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(mss, oqj)
Dim queryCollection As ManagementObjectCollection = mos.Get
Public Function GetName()
For Each getnow As ManagementObject In queryCollection
GetName = getnow("name").ToString
Next
End Function
Public Function GetCaption() As String
For Each getnow As ManagementObject In queryCollection
GetCaption = getnow("Caption").ToString
Next
End Function
Public Function GetManufacturer() As String
For Each getnow As ManagementObject In queryCollection
GetManufacturer = getnow("Manufacturer").ToString
Next
End Function
Public Function GetSpeed() As String
For Each getnow As ManagementObject In queryCollection
GetSpeed = getnow("MaxClockSpeed").ToString
Next
End Function
Public Function GetL2CacheSize() As String
For Each getnow As ManagementObject In queryCollection
GetL2CacheSize = getnow("L2CacheSize").ToString
Next
End Function
Public Function SocketDesignation() As String
For Each getnow As ManagementObject In queryCollection
SocketDesignation = getnow("SocketDesignation").ToString
Next
End Function
Public Function ProcessorId() As String
For Each getnow As ManagementObject In queryCollection
ProcessorId = getnow("ProcessorId").ToString
Next
End Function
Public Function ExtClock() As String
For Each getnow As ManagementObject In queryCollection
ExtClock = getnow("ExtClock").ToString
Next
End Function
Public Function CurrentVoltage() As String
For Each getnow As ManagementObject In queryCollection
CurrentVoltage = getnow("CurrentVoltage").ToString
Next
End Function
Public Function Stepping() As String
For Each getnow As ManagementObject In queryCollection
Stepping = getnow("Stepping").ToString
Next
End Function
Public Function Level() As String
For Each getnow As ManagementObject In queryCollection
Level = getnow("Level").ToString
Next
End Function
Public Function Revision() As String
For Each getnow As ManagementObject In queryCollection
Revision = getnow("Revision").ToString
Next
End Function
Public Function Version() As String
For Each getnow As ManagementObject In queryCollection
Version = getnow("Version").ToString
Next
End Function
End Class
Public Class CurrentUsers
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_UserAccount")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Name() As System.Collections.ObjectModel.Collection(Of String)
Name = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Name.Add(getnow.Item("Name"))
Next
End Function
Public Function Description() As System.Collections.ObjectModel.Collection(Of String)
Description = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Description.Add(getnow.Item("Description"))
Next
End Function
Public Function LocalAccount() As System.Collections.ObjectModel.Collection(Of String)
LocalAccount = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
LocalAccount.Add(getnow.Item("LocalAccount"))
Next
End Function
Public Function SID() As System.Collections.ObjectModel.Collection(Of String)
SID = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
SID.Add(getnow.Item("SID"))
Next
End Function
Public Function Lockout() As System.Collections.ObjectModel.Collection(Of String)
Lockout = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Lockout = getnow.Item("Lockout")
Next
End Function
Public Function PasswordRequired() As System.Collections.ObjectModel.Collection(Of String)
PasswordRequired = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordRequired.Add(getnow.Item("PasswordRequired"))
Next
End Function
Public Function PasswordExpires() As System.Collections.ObjectModel.Collection(Of String)
PasswordExpires = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordExpires.Add(getnow.Item("PasswordExpires"))
Next
End Function
Public Function PasswordChangeable() As System.Collections.ObjectModel.Collection(Of String)
PasswordChangeable = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
PasswordChangeable.Add(getnow.Item("PasswordChangeable"))
Next
End Function
Public Function Disabled() As System.Collections.ObjectModel.Collection(Of String)
Disabled = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
Disabled.Add(getnow.Item("Disabled"))
Next
End Function
End Class
Public Class Floppy
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_FloppyDrive")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function FloppyName() As System.Collections.ObjectModel.Collection(Of String)
FloppyName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
FloppyName.Add(getnow("name"))
Next
End Function
Public Function FloppyManufacturer() As System.Collections.ObjectModel.Collection(Of String)
FloppyManufacturer = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
FloppyManufacturer.Add(getnow("Manufacturer"))
Next
End Function
End Class
Public Class HardDesk
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_diskdrive")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function GetName() As String
For Each getnow As ManagementObject In queryCollection
GetName = getnow("Caption").ToString
Next
End Function
Public Function GetSize() As String
For Each getnow As ManagementObject In queryCollection
GetSize = getnow("size")
Next
End Function
Public Function GetManufacturer() As String
For Each getnow As ManagementObject In queryCollection
GetManufacturer = getnow("Manufacturer").ToString
Next
End Function
Public Function GetSerial() As String
Dim HDinformation As New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
Dim HD As ManagementObject
For Each HD In HDinformation.Get()
GetSerial = HD("SerialNumber").ToString()
Next
End Function
Public Function BytesPerSector() As String
For Each getnow As ManagementObject In queryCollection
BytesPerSector = getnow("BytesPerSector").ToString
Next
End Function
Public Function Description() As String
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description").ToString
Next
End Function
Public Function MediaType() As String
For Each getnow As ManagementObject In queryCollection
MediaType = getnow("MediaType").ToString
Next
End Function
Public Function Model() As String
For Each getnow As ManagementObject In queryCollection
Model = getnow("Model").ToString
Next
End Function
Public Function TotalCylinders() As String
For Each getnow As ManagementObject In queryCollection
TotalCylinders = getnow("TotalCylinders").ToString
Next
End Function
Public Function TotalSectors() As String
For Each getnow As ManagementObject In queryCollection
TotalSectors = getnow("TotalSectors").ToString
Next
End Function
Public Function TotalHeads() As String
For Each getnow As ManagementObject In queryCollection
TotalHeads = getnow("TotalHeads").ToString
Next
End Function
Public Function TotalTracks() As String
For Each getnow As ManagementObject In queryCollection
TotalTracks = getnow("TotalTracks").ToString
Next
End Function
End Class
Public Class keyboard
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_keyboard")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function KetBName()
For Each getnow As ManagementObject In queryCollection
KetBName = getnow("name")
Next
End Function
Public Function KetBstatus()
For Each getnow As ManagementObject In queryCollection
KetBstatus = getnow("status")
Next
End Function
Public Function KetBDeviceID()
For Each getnow As ManagementObject In queryCollection
KetBDeviceID = getnow("DeviceID")
Next
End Function
Public Function Description()
For Each getnow As ManagementObject In queryCollection
Description = getnow("Description")
Next
End Function
End Class
Public Class LogicalDisk
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim oqj As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_LogicalDisk")
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(mss, oqj)
Dim queryCollection As ManagementObjectCollection = mos.Get
Public Function DiskCaption() As System.Collections.ObjectModel.Collection(Of String)
DiskCaption = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskCaption.Add(getnow("caption"))
Next
End Function
Public Function DiskDeviceID() As System.Collections.ObjectModel.Collection(Of String)
DiskDeviceID = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskDeviceID.Add(getnow("DeviceID"))
Next
End Function
Public Function DiskDriveType() As System.Collections.ObjectModel.Collection(Of String)
DiskDriveType = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskDriveType.Add(getnow("DriveType").ToString)
Next
End Function
Public Function DiskFileSystem() As System.Collections.ObjectModel.Collection(Of String)
DiskFileSystem = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskFileSystem.Add(getnow("FileSystem"))
Next
End Function
Public Function DiskFreeSpace() As System.Collections.ObjectModel.Collection(Of String)
DiskFreeSpace = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskFreeSpace.Add(getnow("FreeSpace"))
Next
End Function
Public Function DiskMediaType() As System.Collections.ObjectModel.Collection(Of String)
DiskMediaType = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskMediaType.Add(getnow("MediaType").ToString)
Next
End Function
Public Function DiskSize() As System.Collections.ObjectModel.Collection(Of String)
DiskSize = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskSize.Add(getnow("Size"))
Next
End Function
Public Function DiskVolumeName() As System.Collections.ObjectModel.Collection(Of String)
DiskVolumeName = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskVolumeName.Add(getnow("VolumeName"))
Next
End Function
Public Function DiskVolumeSerialNumber() As System.Collections.ObjectModel.Collection(Of String)
DiskVolumeSerialNumber = New System.Collections.ObjectModel.Collection(Of String)
For Each getnow As ManagementObject In queryCollection
DiskVolumeSerialNumber.Add(getnow("VolumeSerialNumber"))
Next
End Function
End Class
Public Class Memory
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_physicalmemory")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Names()
For Each getnow As ManagementObject In queryCollection
Names = getnow("name")
Next
End Function
Public Function Capacity()
For Each getnow As ManagementObject In queryCollection
Capacity = getnow("Capacity")
Next
End Function
Public Function DeviceLocator()
For Each getnow As ManagementObject In queryCollection
DeviceLocator = getnow("DeviceLocator")
Next
End Function
Public Function TotalWidth()
For Each getnow As ManagementObject In queryCollection
TotalWidth = getnow("TotalWidth")
Next
End Function
End Class
Public Class Monitor
Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" + machineName + "\root\cimv2", con)
Dim ob As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_DesktopMonitor")
Dim moss As ManagementObjectSearcher = New ManagementObjectSearcher(mss, ob)
Dim queryCollection As ManagementObjectCollection = moss.Get
Public Function Caption()
For Each getnow As ManagementObject In queryCollection
Caption = getnow("Caption")
Next
End Function
Public Function DeviceID()
For Each getnow As ManagementObject In queryCollection
DeviceID = getnow("DeviceID")
Next
End Function
Public Function MonitorManufacturer()
For Each getnow As ManagementObject In queryCollection
MonitorManufacturer = getnow("MonitorManufacturer")
Next
End Function
Public Function ScreenHeight()
For Each getnow As ManagementObject In queryCollection
ScreenHeight = getnow("ScreenHeight")
Next
End Function
Please SUBSCRIBE to get new articles directly into your Email inbox!
تعليقات
إرسال تعليق