Tue. Apr 16th, 2024

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
moHD.[Get]()
Return moHD(“VolumeSerialNumber”).ToString()

End Function

 

Loading ....

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.