Microsoft® Visual Basic® Scripting Edition
SerialNumber Property
 Language Reference 
Version 3 

See Also                  Applies To


Description
Returns the decimal serial number used to uniquely identify a disk volume.
Syntax
object.SerialNumber

The object is always a Drive object.

Remarks
You can use the SerialNumber property to ensure that the correct disk is inserted in a drive with removable media.

The following code illustrates the use of the SerialNumber property:

Function ShowDriveInfo(drvpath)
  Dim fso, d, s, t
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath)))
  Select Case d.DriveType
    Case 0: t = "Unknown"
    Case 1: t = "Removable"
    Case 2: t = "Fixed"
    Case 3: t = "Network"
    Case 4: t = "CD-ROM"
    Case 5: t = "RAM Disk"
  End Select
  s = "Drive " & d.DriveLetter & ": - " & t
  s = s & "<BR>" & "SN: " & d.SerialNumber
  ShowDriveInfo = s
End Function