Get Motherboard Serial Number In Vb6
Get mother board serial numbers and CPU IDs in Visual Basic.NET: Description: This example shows how to use WMI to get mother board serial numbers and CPU IDs in Visual Basic.NET. Keywords: serial number, cpu, cpu id, WMI, Windows Management Instrumentation, Visual Basic.NET, VB.NET.
|
This example shows how to get the system’s board serial numbers and CPU IDs. WMI (Windows Management Instrumentation) lets you use SQL-like statements to ask the computer about itself.
The GetBoardSerialNumbers function shown in the following code returns a list containing the mother board serial numbers.
The code uses the WMI query SELECT * FROM Win32_BaseBoard to get information about the system’s mother boards (base boards). The code loops through the resulting collection of Win32_BaseBoard ManagementObjects and adds their SerialNumber values to the result list.
The GetCpuIds function shown in the following code returns a list containing the system’s CPU IDs.
This method uses the WMI query SELECT * FROM Win32_Processor to get information about the system’s processors. The code loops through the resulting collection of Win32_Processor ManagementObjects and adds their ProcessorId values to the result list.
The following code shows how the main program displays the results in ListBoxes.
This code simply calls the two methods to get the board serial numbers and the CPU IDs. It then sets the ListBox controls’ DataSource properties equal to the returned lists of values.