Converting the FileSystemObject's FreeSpace Property

Definition: The amount of free disk space on a given drive.

FreeSpace

See AvailableSpace. To retrieve the amount of free space on a drive, we use the New-Object cmdlet to create a DriveInfo object referencing - in this example - the C: drive. We then simply check the AvailableFreeSpace property.

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

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