1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
Imports System.Management
Public Class WMI
Public Class Hardware
Public Shared Function GetProperties(ByVal [Class] As Win32) As Collections.Generic.Dictionary(Of String, String())
Dim MOS As ManagementObjectSearcher = New ManagementObjectSearcher("Select * from Win32" & [Class].ToString)
Dim MOC As ManagementObjectCollection = MOS.Get
Dim MO As ManagementObject
Dim PD As PropertyData
Dim HWList As New Collections.Generic.Dictionary(Of String, String())
For Each MO In MOC
For Each PD In MO.Properties
If Not PD.Value Is Nothing Then
If HWList.ContainsKey(PD.Name) = False Then
HWList.Add(PD.Name, GetProperty([Class], PD.Name))
End If
End If
Next
Next
Return HWList
End Function
Public Shared Function GetProperty(ByVal [Class] As Win32, ByVal [Property] As String) As String()
Dim MOS As ManagementObjectSearcher = New ManagementObjectSearcher("Select " & [Property] & " from Win32" & [Class].ToString)
Dim MOC As ManagementObjectCollection = MOS.Get
Dim MO As New ManagementObject
Dim Values As New List(Of String)
Try
For Each MO In MOC
Values.Add(MO.GetPropertyValue([Property]))
Next
Catch ex As Exception
Return Nothing
End Try
Return Values.ToArray
End Function
Public Enum Win32 As Integer
'Cooling Device Classes
_Fan
_HeatPipe
_Refrigeration
_TemperatureProbe
'Input Device Classes
_Keyboard
_PointingDevice
'Mass Storage Classes
_AutochkSetting
_CDROMDrive
_DiskDrive
_FloppyDrive
_PhysicalMedia
_TapeDrive
'Motherboard, Controller, and Port Classes
_1394Controller
_1394ControllerDevice
_AllocatedResource
_AssociatedProcessorMemory
_BaseBoard
_BIOS
_Bus
_CacheMemory
_ControllerHasHub
_DeviceBus
_DeviceMemoryAddress
_DeviceSettings
_DMAChannel
_FloppyController
_IDEController
_IDEControllerDevice
_InfraredDevice
_IRQResource
_MemoryArray
_MemoryArrayLocation
_MemoryDevice
_MemoryDeviceArray
_MemoryDeviceLocation
_MotherboardDevice
_OnBoardDevice
_ParallelPort
_PCMCIAController
_PhysicalMemory
_PhysicalMemoryArray
_PhysicalMemoryLocation
_PNPAllocatedResource
_PNPDevice
_PNPEntity
_PortConnector
_PortResource
_Processor
_SCSIController
_SCSIControllerDevice
_SerialPort
_SerialPortConfiguration
_SerialPortSetting
_SMBIOSMemory
_SoundDevice
_SystemBIOS
_SystemDriverPNPEntity
_SystemEnclosure
_SystemMemoryResource
_SystemSlot
_USBController
_USBControllerDevice
_USBHub
'Networking Device Classes
_NetworkAdapter
_NetworkAdapterConfiguration
_NetworkAdapterSetting
'Power Classes
_AssociatedBattery
_Battery
_CurrentProbe
_PortableBattery
_PowerManagementEvent
_UninterruptiblePowerSupply
_VoltageProbe
'Printing Classes
_DriverForDevice
_Printer
_PrinterConfiguration
_PrinterController
_PrinterDriver
_PrinterDriverDll
_PrinterSetting
_PrintJob
_TCPIPPrinterPort
'Telephony Classes
_POTSModem
_POTSModemToSerialPort
'Video and Monitor Classes
_DesktopMonitor
_DisplayConfiguration
_DisplayControllerConfiguration
_VideoConfiguration
_VideoController
_VideoSettings
End Enum
End Class
End Class
|