Get H/D Serial number (Not Volumn Serial Number) for IDE and SATA

前端 未结 3 501
有刺的猬
有刺的猬 2020-12-20 04:28

How can I read the hard disk serial number for IDE and SATA drives in VB.NET? (I don\'t want the volume serial number).

This info should be gathered both for XP and

3条回答
  •  别那么骄傲
    2020-12-20 04:43

    Here is the code to get HDD Serial Number

        Dim HDD_Serial As String
    
        Dim hdd As New ManagementObjectSearcher("select * from Win32_DiskDrive")
    
        For Each hd In hdd.Get
    
            HDD_Serial = hd("SerialNumber")
            MsgBox(HDD_Serial)
        Next
    

    Hope it Helps.

提交回复
热议问题