views:

8

answers:

1

Hi,

so the following code:

Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim colDrives : Set colDrives = objFSO.Drives
Dim objWMIService : Set objWMIService = GetObject("winmgmts:")
Dim objLogicalDisk
Dim objDrive

For Each objDrive in colDrives
    Set objLogicalDisk = 
objWMIService.Get("Win32_LogicalDisk.DeviceID='" & objDrive.DriveLetter & ":'")
    Log(objLogicalDisk.DriveType)
Next

is used to get the disk type of each drive on a system. What I want to know is, what do the returned numbers ('3','4','5', etc) refer to? Looking around on the internet I find different answers to what they should be on my system - according to the internet:

Unknown = 0

Removable = 1 ' Removable medium

Fixed = 2 ' Fixed medium (hard disk)

Remote = 3 ' Network drive

CDROM = 4 ' CD-ROM

RAMDisk = 5 ' RAM disk

and according to the data i've gathered so far, 3 = my Local C Drive, 5 = my local D (DVD) Drive, 4 = network drives.

If anyone can help clear up this ambiguity, that would be great :)

+1  A: 

The official WMI reference is in the MSDN library.

As for your question, the Win32_LogicalDisk class reference describes the following DriveType values:

Value    Meaning
--------------------------
0        Unknown
1        No Root Directory
2        Removable Disk
3        Local Disk
4        Network Drive
5        Compact Disc
6        RAM Disk
Helen
Cheers - exactly what I needed. I should have googled more!
simonalexander2005