Laufwerksinformationen ermitteln

Per System.Management Laufwerksinformationen ermitteln






Es muss
die Klasse System.Management über hinzufügen eingefügt werden.





Private
Sub Form1_Load(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
MyBase.Load


GetInfo()


End Sub








Private Sub
GetInfo()


Dim mos As
Management.ManagementObjectSearcher


Dim moc As
Management.ManagementObjectCollection


Dim mo As
Management.ManagementObject


Dim pd As
Management.PropertyData




mos = New
Management.ManagementObjectSearcher("SELECT * from Win32_LogicalDisk")


moc = mos.Get


For Each mo
In moc


Try


LvDrvs.Items.Add(mo.Path.ToString)
In ListView-Steuerelement


Catch ex
As Exception




End Try





For Each
pd In mo.Properties


Try


LvDrvs.Items.Add(pd.Name + "=" + pd.Value.ToString)


Catch ex
As Exception




End
Try


Next


Next


moc.Dispose()


mos.Dispose()



End
Sub