我试图创建一个程序来收集有关用户个人电脑的信息。到目前为止,我已经能够收集到诸如操作系统、处理器、硬盘大小和图形信息之类的信息,我只是想知道如何收集他们正在使用的主板的名称(或型号)以及制造商他们机器中的硬盘驱动器。任何帮助,将不胜感激。
谢谢
我试图创建一个程序来收集有关用户个人电脑的信息。到目前为止,我已经能够收集到诸如操作系统、处理器、硬盘大小和图形信息之类的信息,我只是想知道如何收集他们正在使用的主板的名称(或型号)以及制造商他们机器中的硬盘驱动器。任何帮助,将不胜感激。
谢谢
You can use the WMI Code Creator to look into what is available with WMI. Bear in mind that all of the information you want might not be available. You can try Win32_BaseBoard
for your Motherboard information.
Example code from the Creator for Disk Drive Model information:
Imports System
Imports System.Management
Imports System.Windows.Forms
Namespace WMISample
Public Class MyWMIQuery
Public Overloads Shared Function Main() As Integer
Try
Dim searcher As New ManagementObjectSearcher( "root\CIMV2", "SELECT * FROM Win32_DiskDrive")
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("-----------------------------------")
Console.WriteLine("Win32_DiskDrive instance")
Console.WriteLine("-----------------------------------")
Console.WriteLine("Model: {0}", queryObj("Model"))
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
End Function
End Class
End Namespace