Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB7
Expertise: Intermediate
Sep 29, 2003

GetDriveSerialNumber - Retrieving the serial number of the specified drive

' Retrieve the serial number of the specified drive
' Note: requires a reference to the System.Management assembly
' Example: MessageBox.Show(GetDriveSerialNumber("D"c))

Function GetDriveSerialNumber(ByVal driveLetter As Char) As String
    Dim driveFilter As String = "Win32_LogicalDisk=""" & driveLetter.ToString & _
        ":"""
    Dim drive As New System.Management.ManagementObject(driveFilter)
    Return drive("VolumeSerialNumber")
End Function
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap