VB.Net/Windows System/Management
Версия от 16:40, 26 мая 2010; (обсуждение)
Get Drive Serial
Public Class MainClass
Public Shared Function GetDriveSerial(ByVal DriveLetter As String) As String
Dim strSelectText As String = "Win32_logicaldisk="" & DriveLetter & """
Dim objMO As New System.Management.ManagementObject(strSelectText)
objMO.Get()
Return CType(objMO.Properties("VolumeSerialNumber").Value, String)
End Function
Public Shared Sub Main
System.Console.WriteLine(GetDriveSerial("C:"))
End Sub
End Class