PowerShell Script: Find the largest files and folders for any drive

Update – 04.06.2021 – I have an updated version of this script that is a little more flexible and has better output, you can find the new script here:

This is a super easy to use and flexible PowerShell script to find out what the largest files and folders are on a single drive. I find this script particularly useful in situations where you have a lot of servers that are being monitored for disk space and you need to quickly and easily find the largest offenders but take all of that information and put it in a readable format. That is why I call this my “low disk space” script. It is also nice to be able to pull this off without installing any software.

Here is the basic flow of the script:

  1. Scan the drive for total space free and used
  2. Scan for the largest files
  3. List the size of all of the folders on the root dir
  4. Interactive scan of specific sub folders

Notes: As always with PowerShell, you will need to set the execution policy for your environment accordingly. There are variables at the top of the script that can be edited to change various settings like the drive, extensions, file size, amount of files to list (ie top 25) and so on.


  1. Save to local machine as .ps1
  2. Open PowerShell as administrator
  3. Set your execution policy in PowerShell accordingly
  4. Change directory to where the script is and running it by typing .\FindLargestFilesAndFolders.ps1

Script download:


Example output:

Comments are closed.