使用visual basic查找主板名称和硬盘驱动器 [英] Find the name of motherboard and make of hard drive using visual basic

查看:31
本文介绍了使用visual basic查找主板名称和硬盘驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个程序来收集有关用户电脑的信息.到目前为止,我已经能够收集诸如操作系统、处理器、硬盘驱动器大小和图形信息之类的信息,我只是想知道如何收集他们正在使用的主板的名称(或型号)以及主板的制造商他们机器上的硬盘.任何帮助,将不胜感激.

Im trying to create a program to gather information about users pcs. So far I have been able to gather thigns like the os, processor, hard drive size and graphics information and I was just wondering how I would be able to collect the name of the motherboard they are using (or model) and the make of the hard drives in their machines. Any help would be appreciated.

谢谢

推荐答案

您可以使用 WMI 代码创建者 以了解 WMI 的可用功能.请记住,您可能无法获得您想要的所有信息.您可以尝试 Win32_BaseBoard 获取您的主板信息.

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.

来自 Creator 的用于磁盘驱动器型号信息的示例代码:

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

这篇关于使用visual basic查找主板名称和硬盘驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆