vb.net – Find Hard Disc Serial Number

vb.net – Find hard-disc serial number
A lot of times you need to get the serial number of the harddisc of the user for all kind of purpeses. Here you can learn how to do it fast and easy with vb.net

Here is a copy of the function I used in this software:

Public Function GetHDSerialNo(ByVal strDrive As String) As String ‘Get HD Serial Number

‘Ensure Valid Drive Letter Entered, Else, Default To C
If strDrive = “” OrElse strDrive Is Nothing Then
strDrive = “C”
End If
Dim moHD As New ManagementObject(“Win32_LogicalDisk.DeviceID=””” + strDrive + “:”””)
‘Get Info
Return moHD(“VolumeSerialNumber”).ToString()

End Function

Leave a Reply

Your email address will not be published. Required fields are marked *