Converting the FileSystemObject's DriveType Property

Windows PowerShell

Definition: Returns the drive type.


In VBScript, the DriveType returns an integer representing the type of drive (i.e., 1 represents a removable drive, 2 represents a fixed drive). In PowerShell you don’t need to worry about converting the integer to something readable. By using the .NET Framework, the DriveType property of the DriveInfo class will return a string containing the drive type.

$d = New-Object -typename System.IO.DriveInfo -argumentlist "C:"

Here’s the output from this code:


See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page