header image

W2KSG: Drive Properties

Posted by: | August 30, 2008 | No Comment |

One of the most used objects in VBScript is the FileSystemObject.  While much of its functionality is available through other means in PowerShell as we will see in future posts there is still much we can do with it.

Script Center Home > Microsoft Windows 2000 Scripting Guide > Scripting Concepts and Technologies for System Administration > Script Runtime Primer > FileSystemObject > Managing Disk Drives  Enumerating Disk Drive Properties

FileSystemObject is a COM object so we can access it through New-Object

Listing 4.3

$fso = New-Object -ComObject "Scripting.FileSystemObject"
$fso.Drives | Format-List

Emulates the VBScript.  Only draw back to it is that the RootFolder isn’t reported in PowerShell.

A lot of this information is available via WMI e.g.

Get-WmiObject -Class Win32_LogicalDisk
Get-WmiObject -Class Win32_DiskDrive
Get-WmiObject -Class Win32_LogicalDiskRootDirectory

Pipe them into get-member to see the wealth of information available.


Share this post :


Technorati Tags: ,


under: PowerShell original