Converting the FileSystemObject's FreeSpace Property

Windows PowerShell

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


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:"

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