Clean Up NuGet Cache Automatically with PowerShell | Save Disk Space

Published 31/10/2025

Description

Clean up your NuGet cache automatically with PowerShell and reclaim disk space by removing old package versions you no longer need. In this video, I show how to build a PowerShell script that scans a NuGet package cache, identifies outdated versions, and removes them safely. I also show how to automate the cleanup with Windows Task Scheduler so it runs at logon without manual effort. 0:00 - Introduction 0:09 - Description 2:16 - Creating the Script 5:55 - Automating 8:45 - Conclusion This tutorial is useful if your development machine keeps filling up with old NuGet packages and you want a simple way to keep things under control. I walk through the cleanup problem, create a reusable and parameterized PowerShell script, and then schedule it so the process becomes automatic. #NuGet #PowerShell #DotNet Follow me on X: https://l.samayas.eu/jo3eaYEf3E?P=YT&V=30 Sample Code Nuget Cache Cleanup script : https://l.samayas.eu/bqokD5Hn8u?P=YT&V=30 Buy me a Coffee: https://l.samayas.eu/jX6xL7EWhd?P=YT&V=30 Studio Equipment Camera Sony Alpha ZV-E10 II: https://l.samayas.eu/k7y90TREl0?P=YT&V=30 Secondary Camera Obsbot Tail Air: https://l.samayas.eu/iFQu9WfmCw?P=YT&V=30 Elgato Prompter: https://l.samayas.eu/fHVrqqXtSc?P=YT&V=30 Microphone Rode Wireless GO II: https://l.samayas.eu/afBINjiBXN?P=YT&V=30