Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting the FileSystemObject's Drives Property

Windows PowerShell

Definition: Returns a collection of all the drives available on the local computer.


The .NET Framework makes this pretty simple in PowerShell. All you need to do is reference the DriveInfo class and call the GetDrives method:


Notice that we didn’t need to call the New-Object cmdlet to create an instance of the DriveInfo class. That’s because we’re getting information about all the drives, we don’t want information about a specific drive.

You can also use the Get-PSDrive cmdlet to return all the PowerShell drives:


This cmdlet will include “drives” such as registry drives and environment drives.

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
© 2015 Microsoft