Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How is it possible to get HDD serial number not volume no?.

Status
Not open for further replies.

haiprakash

Programmer
May 31, 2003
3
IN
Dear friends...

I am prakash from India. I have to get harddisk serial number in which my application is running on.
my application is in visual basic code. plz help to get the same.

Thanx in advance.

by
prakash
 
Hi Prakash,

The HDD serial number is the number for the volume. Most HD manufacturers use a second number, which they print on a label and attach to the hard drive. Typically, this number is only accessible by the drive hardware/firmware (Let's say you used the manufacturer's disk-prep utility: the software would probably show this HD ID). It is not stored on the physical disk media and can't be retrieved by VB in any consistent, meaningful way from hard drives made by the various manufacturers.



Real men don't use Interrupt 21h.
 
Public Function TransHDD(SerDrive As Integer) As String
Dim FSO, MyDrive, MyPath, Cicle As Integer, Extract As String, Ex As String, LenX As Integer
Set FSO = CreateObject("Scripting.FileSystemObject")
Set MyDrive = FSO.getdrive(FSO.getdrivename(FSO.getabsolutepathname(MyPath)))
If SerDrive = 0 Then
Select Case MyDrive.drivetype
Case 0: TransHDD = "Unknown"
Case 1: TransHDD = "Extern"
Case 2: TransHDD = "OK"
Case 3: TransHDD = "Foreign"
Case 4: TransHDD = "CDROM"
Case 5: TransHDD = "RAM"
End Select
Else
TransHDD = MyDrive.serialnumber
End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top