Get hardware information


Another question from a VB.Net newbie.
I have a small task where I have to retrieve a limited set of information about computer hardware. The details I need are the make, model and serial number (if possible) for the following devices:

1. Network Adapter
2. Graphics chip or card
3. Sound chip or card
4. Motherboard
5. HDD
6. Default printer

I've been able to find out how to get details for some stuff such as BIOS (except the manufacturer), printer settings and so on but not the make, model or serial number.

I have spent several days searching EE and the net for answers before deciding to pose the question

I'm sure that the solution will be fairly simple but since my need is urgent, I have allocated 500 points. I would have made it 1000 but the field wouldn't let me.
Who is Participating?
grayeConnect With a Mentor Commented:
Yes, you can get everything on your list using WMI... including the serial number of the PC.
Take a look at the following for a short tutorial on programming WMI.
I've also got a complete application that you can download to perform this function.... it might be complete overkill (since it records a gazillion thing other than the few you've mentioned).   But you're welcome to take a look (and download the complete VB.Net source code)
I think you'd have to use WMI.
Does this help?
jindaleeAuthor Commented:
Thanks. It helps a little but gives me no idea how I get info about NICs, graphics etc
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

SStoryConnect With a Mentor Commented:
Well, the registry key shown here

shows you how to get the name of the mfg of the card. I don't know about the serial number.

This will give you more information about NIC cards from within

'this gives the info on the first NIC card

of course you'd need to do .whatever after the (0) to get to the properties list
jindaleeAuthor Commented:
Thanks sstory. I am now 1/6th the way to getting the details I need. It was in C# so I had to convert to VB. The code is attached for anyone else who needs the same info.
        Dim keyName As String = ""
        Dim cardServiceName As RegistryKey
        Dim networkcardKey As String = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards"
        Dim serviceKey As String = "SYSTEM\\CurrentControlSet\\Services\\"
        Dim networkcardKeyName As String = "", deviceName As String = "", deviceServiceName As String = "", serviceName As String = ""
        Dim serviceNames As RegistryKey
        serviceNames = Registry.LocalMachine.OpenSubKey(networkcardKey)
        If serviceNames.ToString() = "" Then
            Console.WriteLine("Bad registry key")
        End If
        Dim networkCards As String() = serviceNames.GetSubKeyNames()
        For Each keyName In networkCards
            networkcardKeyName = networkcardKey + "\\" + keyName
            cardServiceName = Registry.LocalMachine.OpenSubKey(networkcardKeyName)
            If cardServiceName.ToString() = "" Then
                Console.WriteLine("Bad registry key: {0}", networkcardKeyName)
                deviceServiceName = cardServiceName.GetValue("ServiceName").ToString()
                dg.Rows(iRows).Cells(0).Value = "Network Connection"
                dg.Rows(iRows).Cells(1).Value = ""
                iRows = iRows + 1
                deviceName = cardServiceName.GetValue("Description").ToString()
                dg.Rows(iRows).Cells(0).Value = "Network Adapter Name"
                dg.Rows(iRows).Cells(1).Value = deviceName.ToString()
                iRows = iRows + 1
            End If

Open in new window

Yes...but I don't imagine you can get the serial number that way..

I have NO experience with WMI, but suspect it might be the answer.  Here is something I found on it:
graye, looks really cool.
jindaleeAuthor Commented:
Thanks.  Completely meets my needs.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.