Export (0) Print
Expand All
Expand Minimize

Converting the FileSystemObject's DriveType Property


Windows PowerShell


Definition: Returns the drive type.

DriveType


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:"
$d.DriveType


Here’s the output from this code:


Fixed


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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft