First, reference the System.Management; then imports system.management in the code;
The following functions rely primarily on WMI implementations
Get the hard drive serial number
The code is as follows |
Copy Code |
Dim Cmicwmi as New System.Management.ManagementObjectSearcher ("SELECT * from Win32_DiskDrive") Dim Uint32 as UInt32 For each cmicwmiobj as ManagementObject in Cmicwmi.get Uint32 = cmicwmiobj ("signature") Next TextBox1.Text = uint32.tostring
|
Get CPU Serial Number
The code is as follows |
Copy Code |
Dim Wmi as New System.Management.ManagementObjectSearcher ("SELECT * from Win32_Processor") Dim Uint32 as String For each wmiobj as ManagementObject in Wmi.get Uint32 = Wmiobj ("Processorid") Next TextBox1.Text = Uint32 |
Get total drive capacity
The code is as follows |
Copy Code |
Dim Wmi as New System.Management.ManagementObjectSearcher ("SELECT * from Win32_DiskDrive") Dim Uint64 as UInt64 For each wmiobj as ManagementObject in Wmi.get Uint64 = wmiobj ("size") Next TextBox1.Text = uint64.tostring
|