I recently ran into a situation where different Win 10 Pro clients treated drive types inconsistently, so thought I'd at least post what I did to circumvent. FSO documentation indicates that properties drivetype = 1 pertains to removable disks and drivetype = 2 pertaining to fixed devices. I encountered one client where their Win 10 system treated a USB flash-drive as fixed rather than removable. I had no direct access to their system, so don't know if there is some sort of auxiliary USB cluster attached to the MB that treats anything plugged in as fixed? Anyway, for what it's worth, here's the code I used to accept either:
Code:
Option Compare Database
Option Explicit
Public Function getDrvLtr(DrLabel As String) As String
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
' For reasons unkown, some Win 10 systems don't consider a flash-drive as removable
' but rather as fixed. So here, we simply test for both.
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
getDrvLtr = GetDrives(DrLabel, 1) 'Success looks like "x:"
If Mid(getDrvLtr, 2, 1) <> ":" Then getDrvLtr = GetDrives(DrLabel, 2)
End Function
Public Function GetDrives(Optional VolName As String = "NONE", Optional DriveType As Integer = 1) As String
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
' The leading "a:" expression will be missing if the specified volume is not found
' among the collection. In any case, the remainder of the returned string will
' be the volume names of the volumes found in the collection, each separated
' by a semicolon. DriveType supported are fixed and removable. Disks & USB
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Dim fs As Object
Dim d As Object
Dim dc As Object
Dim VList As String
GetDrives = ""
VList = ""
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
If (d.DriveType = DriveType) And (d.isready = True) Then
If VList = "" Then
VList = d.volumename
Else
VList = VList & " ; " & d.volumename
End If
'We only return a drive letter if a volume name is passed here
If VolName <> "NONE" Then _
If d.volumename = VolName Then GetDrives = d.driveLetter & ":"
End If
Next
GetDrives = GetDrives & VList
End Function