Converting the FileSystemObject's AvailableSpace Property

Definition: The amount of space available on the specified drive or share.


Available drive space is just one of the properties you can retrieve from the DriveInfo .NET Framework object. Use the New-Object cmdlet to retrieve a reference to the object, passing the drive letter as the argument. Once you have a reference to the DriveInfo object, you can check the AvailableFreeSpace property.

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

Note that this does not work with network shares (i.e., \\atl-fs-01\scripts), it works only with mapped drives letters.

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