Constantly running out of room on your C: drive? Well, this script will help you tidy up your virtual clutter faster than you can say “Marie Kondo”! 

From temporary files to outdated IIS logs, this script will scour your computer for those unnecessary files that have been taking up space, leaving you with ample room to store the things that actually spark joy (Minecraft, anyone?). 

Running the script will clear the C: drive’s temporary files, Windows Software Distribution folder, the local users temporary folder, and IIS logs (if applicable). And once it’s done throwing out those unnecessary files, it will even take out the trash (or empty the recycling bin, as it were). 

While the script is running, you may be prompted to confirm the deletion of any large SO, VHD, and VHDX files that are present on your drive. Plus, the script will stop the Windows Update service in order to access and delete certain files. It will also launch the Windows Disk Cleanup tool (cleanmgr.exe) if it is installed to help remove additional unnecessary files from your hard disk. If you have Microsoft System Center Configuration Manager installed, the script will also reduce the cache size from 5120MB to 1024MB.

Please note that the script will not delete files that are newer than 7 days old by default, though, this can be modified and you may need to reboot your device after running the script. 

Once it has finished running, the script will display the disk usage before and after execution so you can see how much space was freed up. You can expect to free up anywhere from 1GB up to 15GB of space. Deleted files will be logged in a transcript located in $env:TEMP so you can see what’s been removed (the exact path will be displayed after the script is executed).