If you’re looking to manage the storage on your Windows devices, it can be helpful to know which files are taking up the most space on your hard drive. The good news is that you can use a PowerShell script (.ps1) to quickly find the largest files on your C drive.
It can be especially helpful for users who are running out of storage space and need to identify which files are taking up the most space. Give it a try and see how it can help you manage your storage more effectively.
The Script:
Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *
get-ChildItem C:\ -recurse -erroraction silentlycontinue | sort length -descending | select -first 10
Technical Notes:
- This script will run on Windows 10, 11, Server 2008 and upwards.
- Admin permissions needed to run this script.
- Get-ChildItem cmdlet: Retrieve all the items in the specified location. The recurse parameter is included to ensure that all files and folders within subfolders are also included in the search.
- Sort cmdlet: Sorts the items by length in descending order.
- Select cmdlet: Selects the first 10 items in the sorted list (which will give you the top 10 largest files on your C drive).