Remotely retrieve disk size, FreeSpace and % of FreeSpace with PowerShell

This script uses the win32_LogicalDisk WMI Class to get Local Disk Information for one or multiple computers. For more information on the DriveTypes available with the Win32_LogicalDisk class visit:

You could also expand on this script and add email capability and schedule it as a job or a scheduled task. That way it runs without human input on a scheduled basis and emails the results.

Information retrieved:
System Name, DeviceID, Volume Name, Size(GB), FreeSpace(GB), % FreeSpace(GB), and the date/time the script is executed.

Output options included: Out-Gridview, a Table, CSV file and an HTML file.




  1. Martin Bluck | | Reply

    This looks good, could you please provide an example of what the computers.txt file should look like?

  2. runebjorndal | | Reply

    This script looks really usefull! Can you please provide an example on how the computers.txt file is supposed to look like? I tried it on my local client first with only my hostname inside but get the error:

    Get-Content : Cannot find path ‘C:\scripts\drive_info\computers.txt’ because it does not exist.
    At line:1 char:1
    + Get-Content “C:\scripts\drive_info\computers.txt”
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\scripts\drive_info\computers.txt:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

    I’ve checked the file paths 🙂


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.