Choose what you like the most WinAPI or Scripting:
Option Explicit
Declare Function GetVolumeInformation Lib "kernel32" Alias _
"GetVolumeInformationA" (ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long
Public Function GetVolumeSN(byval optional strDrive As String = "C:\") As String
Dim lpRootPathName As String, lpVolumeNameBuffer As String
Dim nVolumeNameSize As Long, lpVolumeSerialNumber As Long
Dim lpMaximumComponentLength As Long, lpFileSystemFlags As Long
Dim lpFileSystemNameBuffer As String, nFileSystemNameSize As Long
Dim ReturnVal As Long
ReturnVal = GetVolumeInformation(strDrive, _
lpVolumeNameBuffer, _
nVolumeNameSize, _
lpVolumeSerialNumber, _
lpMaximumComponentLength, _
lpFileSystemFlags, _
lpFileSystemNameBuffer, _
nFileSystemNameSize)
GetVolumeSN = Hex(lpVolumeSerialNumber)
End Funtion
Public Function GetVolumeSN(strDrive As String) As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
GetVolumeSN = fso.GetDrive(strDrive).SerialNumber
End Function
Good luck!