this following code to read name and serial number of HD :
Private Type DRIVEINFO
HDDModel As String
HDDIType As String
HDDSerialNum As String
End Type
Dim info As DRIVEINFO
Public Function HDDSerialNumber()
Dim objs As Object
Dim obj As Object
Dim WMI As Object
Set WMI = GetObject("WinMgmts:")
Set objs = WMI.InstancesOf("Win32_DiskDrive")
For Each obj In objs
info.HDDModel = obj.Model
info.HDDIType = obj.InterfaceType
Next obj
Set objs = WMI.InstancesOf("Win32_PhysicalMedia")
For Each obj In objs
info.HDDSerialNum = obj.SerialNumber
Next obj
Text1.Text = info.HDDModel
Text2.Text = info.HDDIType
Text3.Text = info.HDDSerialNum
End Function
Private Sub Form_Load()
HDDSerialNumber
End Sub Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444