A while ago, I wrote about Installing Windows software with Chocolatey: a few notes and A choco install list, mentioned choco-cleaner in both (see first quote below) but forgot to show where this excels.
This is what I wrote:
since there is no
choco cleanup
yet [WayBack] you need to either:
- install [WayBack] Chocolatey Gallery | (unofficial) Choco Cleaner (Script + Task) once, then every time you want to cleanup:
- wait for the default cleanup task to run on Sundays at 23:00 local time
- from an elevated console, run
%ChocolateyInstall%\lib\choco-cleaner\tools\choco-cleaner-manual.bat
- if you have a [WayBack] Chocolatey licensed edition, install [WayBack] FeaturesPackageReducer
- run
rd /s /q %Temp%\chocolatey%
every now and then (cleans less than the above methods).…
If you want to clean cruft:
choco install --yes choco-cleaner
It helps a lot for situations where chocolatey updates a package, but you still have the old software running. In that case, the old version will be in %ProgramData%\chocolatey\lib-bkp
, potentially taking up a lot of disk space.
This happed to me for instance when still having Process Explorer open while upgrading.
This is what happened:
ShimGen has successfully created a shim for ZoomIt.exe This is try 1/3. Retrying after 300 milliseconds. Error converted to warning: Toegang tot het pad procexp.exe is geweigerd. This is try 2/3. Retrying after 400 milliseconds. Error converted to warning: Toegang tot het pad procexp.exe is geweigerd. Maximum tries of 3 reached. Throwing error. Attempted to remove 'C:\ProgramData\chocolatey\lib-bkp\sysinternals' but had an error:: Toegang tot het pad procexp.exe is geweigerd. The upgrade of sysinternals was successful. Software installed to 'C:\ProgramData\chocolatey\lib\sysinternals\tools' Chocolatey upgraded 1/21 packages. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log). Upgraded: - sysinternals v2019.3.18 C:\>C:\ProgramData\chocolatey\lib\choco-cleaner\tools\choco-cleaner-manual.bat Choco-Cleaner.ps1 v0.0.5.2 (01/09/2019) - deletes unnecessary residual Chocolatey files to free up disk space Copyleft 2017-2019 Bill Curran (bcurran3@yahoo.com) - free for personal and commercial use Choco-Cleaner Summary: ** Deleting unnecessary Chocolatey _processed.txt (WTF?) file... ** Deleting unnecessary Chocolatey .ignore files... ** Deleting unnecessary Chocolatey .old files... ** Deleting unnecessary Chocolatey cache files... ** Deleting unnecessary Chocolatey config backup files... ** Deleting unnecessary Chocolatey lib-bad package files... ** Deleting unnecessary Chocolatey lib-bkp package files... ** Deleting unnecessary Chocolatey extracted file logs... ** Deleting unnecessary Chocolatey log files... ** Deleting unnecessary Chocolatey package embedded archive files in toolsDir... ** Deleting unnecessary Chocolatey package embedded archives and executables in .nupkg files... ** Deleting unnecessary Chocolatey package embedded license files... ** Deleting unnecessary Chocolatey package embedded Microsoft installers... ** Deleting unnecessary Chocolatey package embedded various read me files... ** Deleting unnecessary Nuget cache files... Choco-Cleaner finished deleting unnecessary Chocolatey files and saved you 85.008 KB! Found Choco-Cleaner.ps1 useful? Buy me a beer at https://www.paypal.me/bcurran3donations Become a patron at https://www.patreon.com/bcurran3
–jeroen