valid drives

  • Thread starter Thread starter David A. Osborn
  • Start date Start date
D

David A. Osborn

Is there a way to check if a drive is valid, both when you know the drive
letter and when you want to get a listing of all valid drive letters?
 
| Is there a way to check if a drive is valid, both when you know the drive
| letter and when you want to get a listing of all valid drive letters?

yes.
 
David,

See this below, the style shows that it is not from me, however I don't know
where I got it anymore.

Imports System.Management
\\\
Dim searcher As New ManagementObjectSearcher _
("SELECT * FROM Win32_LogicalDisk")
Dim ManObjOp As ManagementObject
If searcher.Get.Count > 1 Then
For Each ManObjOp In searcher.Get
Dim win32 As String = "Win32_LogicalDisk='" &
ManObjOp("Name").ToString & "'"
Dim ManObjLogD As New ManagementObject(win32)
For Each diskProperty As PropertyData In
ManObjLogD.Properties
If Not diskProperty.Value Is Nothing Then
Console.WriteLine _
("{0} = {1}", diskProperty.Name, diskProperty.Value)
End If
Next
Next
End If
///
I hope this helps a little bit?

Cor
 
GetLogicalDrives API will give you a list of all currently available
drives:

Friend Declare Function GetLogicalDrives Lib "kernel32.dll" ( _
) As Int32

Roman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top