Home (RSS)‎ > ‎

How to Make CCleaner Clean All Accounts on the Fly

posted Aug 23, 2010, 1:37 AM by Evan Greene   [ updated Aug 23, 2010, 10:53 AM ]
I've seen a lot of questions on various forums asking how to make CCleaner run it's routine to clean out all user accounts, and not just the one that's currently logged in.  The best answer so far that I've seen consisted of writing a script that executed when the user logged on that ran CCleaner from the command line.  However, I did not see a way how to clean all accounts on the fly.  If you have other user accounts on your machine just for running applications under different credentials, that never log in, the logon script would not be a viable solution.  For this reason, I decided I'd make use of the PsExec tool again to see if I could accomplish what I needed to do.

This is the steps I took to utilize CCleaner on all user accounts so that I could clean them on-the-fly.  It consists of launching CCleaner under different user accounts so that it will clean each of them.

Applications/Tools required: PsExec and CCleaner

1) Open Windows Explorer and browse to: "C:\Documents and Settings\My User Account\Start Menu\Programs\"
2) Create a new folder called "CrapClean"
3) Browse to the "CrapClean" folder
4) Right-Click -> New -> Text Document
5) Name this file: "CClean All.bat" (be sure that file extensions are visible)


Notice I put mine in the All Users folder, but you may wish to put it in your User Account folder, because this example means everyone will have access to the passwords.

6) Right click "CClean All.bat" -> Edit
7) Now just paste this text into the notepad window:

:: Clean Current User Account
"C:\Documents and Settings\All Users\Tools\CCleaner\CCleaner.exe" /auto

:: Clean the account named "Limited" that has the password "MyPassword"
"C:\Documents and Settings\All Users\Tools\PsTools\PsExec.exe" -u Limited -p MyPassword "C:\Documents and Settings\All Users\Tools\CCleaner\CCleaner.exe" /auto

Just change the above code to point to the account names you want to clean.  There's no limit to the accounts you can clean.

8) Make sure your CCleaner is located at "C:\Documents and Settings\All Users\Tools\CCleaner\" and PsExec is at "C:\Documents and Settings\All Users\Tools\PsExec\"

9) Now to run the script, just go to Start->Programs->CrapClean->"CClean All.bat" and the batch script will silent run CCleaner on all user accounts you specified in the script.

NOTE: This does require you to store the password in plaintext.  Be sure to encrypt your drive and not allow any other users access to your account to protect this information.
Comments