none
I would like to find the model and manufacturer of HDD RRS feed

  • Question

  • I have the code to find the serial number of a HDD, but I cannot get the model or manufacturer. Where can I find the correct syntax?

    Imports System.Management
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
            For Each wmi_HD As ManagementObject In searcher.Get()
                MessageBox.Show(wmi_HD("SerialNumber"), " HDD Serial Number:")
            Next
    
        End Sub
    End Class

    Tuesday, June 12, 2018 3:49 PM

Answers

  • You can use Win32_DiskDrive
    • Marked as answer by VBShaper Wednesday, June 13, 2018 2:13 AM
    Tuesday, June 12, 2018 4:25 PM
  • Hi VBShaper,

    One easy way it to use cmd:

    You can also read by vb.net

            Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")
            For Each HD As ManagementObject In searcher.Get()
                Label1.Text = HD("model").ToString()
                Label2.Text = HD("Manufacturer").ToString()
            Next
    

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by VBShaper Thursday, June 14, 2018 4:24 PM
    Wednesday, June 13, 2018 6:16 AM
    Moderator

All replies

  • You can use Win32_DiskDrive
    • Marked as answer by VBShaper Wednesday, June 13, 2018 2:13 AM
    Tuesday, June 12, 2018 4:25 PM
  • Can you give me an example?

    Wednesday, June 13, 2018 1:58 AM
  • Hi VBShaper,

    One easy way it to use cmd:

    You can also read by vb.net

            Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")
            For Each HD As ManagementObject In searcher.Get()
                Label1.Text = HD("model").ToString()
                Label2.Text = HD("Manufacturer").ToString()
            Next
    

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by VBShaper Thursday, June 14, 2018 4:24 PM
    Wednesday, June 13, 2018 6:16 AM
    Moderator
  • Thank you.
    Thursday, June 14, 2018 4:24 PM