Getting the Hard Disk serial number

  • Thread starter Thread starter Moira
  • Start date Start date
M

Moira

Hi all,
I am developing a macro in access (vb 6.3) for which I need the serial
number of the hard disk. the results of my search, suggest me to use Volume
Number of the drive (ie c: , d: etc); but this volume number changes
whenever that volume is formatted.
The same software developed in dotnet uses the WMI application, but I can't
translate.
Can anybody help in getting the Hard Disk serial number which will not
change?
Thanks in advance and I'm sorry for my bad english
Moira
 
Hi,
Does this number is fixed to HDD hardware? or it will be changed if you
re-partition the hard disk ? or even it is different number if you view it
from different Ms Windows installed in parallel on the same PC?

Thanks
Quang
 
Hi,
I have deeper look on the code. This function shows Volume Serial Number.
It will be changed if the hard disk is re-partitioned.

/Quang
 
Hi,
I am using this simple code to get VOLUME serial number:

Public function volumeserialnumber() as long
Dim vrtFileSystem As Variant
Dim vrtDrive As Variant

Set vrtFileSystem = CreateObject("Scripting.FileSystemObject")
Set vrtDrive =
vrtFileSystem.GetDrive(vrtFileSystem.GetDriveName(vrtFileSystem.GetAbsolutePathName("c:\")))

volumeserialnumber= vrtDrive.serialNumber

debug.print volumeserialnumber

end function

NOTE that this function return the same value as function showed on
http://www.andreavb.com/tip030015.html (this function convert Long variable
"Serial" to Hex format. If you print "Serial" variable, you will get the same
value)

Regards
Tran Hong Quang
 
Back
Top