Reading Serial Number of Drives in

To index files on removable drives one variable you need, to uniquely identify every drive is the drive’s serial number. Below is a simple method in to read the serial number of a drive
To start with
1.    Add System.Management as a reference to the project
2.    Also Imports System.Management to the class that will read the serial number
3.    Below is a function to return the drive’s serial Number

Function readDriveSerial (Byval drive as String) as String
‘u have to test if the drive is ready
Dim dsk1 As New ManagementObject("Win32_LogicalDisk.DeviceId=’"     + drive + "’")
Dim serial as String = CType(dsk1("VolumeSerialNumber"), String)
Return serial
End Function