December 3, 2013

Working in the IT field, you've probably ran across at least one situation where you've had to "clean" your PC by clearing out temporary files and system caches. There are numerous tools that can make this task extremely easy to perform, one being CCleaner by Piriform. It's a great tool for running on your own PC, but running it across an entire corporation can be a daunting task... unless you've purchased the CCleaner Network Edition or higher.

Have no fear though. In just a short amount of time, you can configure CCleaner, silently install it, and then run it across your entire home workgroup or corporate network. Before you can begin, however, you will need to install CCleaner onto your own PC. This is a very straightforward installation, thus will not be covered in this article.

With CCleaner installed, you will first need to open a Command Prompt terminal and navigate to its installation directory. From here, you will need to run the following command:

CCleaner.exe /export

Running this command will create three files within the CCleaner directory:

- winapp.ini
- winreg.ini
- winsys.ini

Now you will need to rename each of the files to the following: "winapp1.ini", "winreg1.ini" and "winsys1.ini". This will allow you to configure the desired cleaning settings for CCleaner, which you will be able to deploy across your network.

Feel free to edit the INI files to fit your desired needs. Piriform themselves have some decent documentation on how to use the INI files. It is, however, just as easy to play around with the files yourself by editing and/or deleting entries. I, personally, have slimmed down the INI files by removing entries that do not apply to my setup, along with focusing mostly on cleaning browser files. Again, everyone will have different requirements and/or preferences on this.

After tweaking the settings for CCleaner, you can begin silently deploying it across your network. For my example, I will be using the CCleaner "Slim" edition. This particular version does not include the toolbar that is included with the standard installer. Also, as not everyone has a software deployment solution in place, we will be using a network share to store the install/config files and a BATCH script for the installation itself.

Ensure that everyone has, at a minimum, Read access to the folder within the network share where you have places the files. After doing so, you will need to run something similar to the following BATCH script on every desired PC (Logon Scripts are a great and easy way to do this):

CD /d C:\
%DRIVE%\CCSetup_Slim.exe /S /D=C:\IT_Tools\CCleaner
NET USE %DRIVE% /delete /y
IF EXIST "C:\Documents and Settings\All Users\Start Menu\Programs\CCleaner" (
     RD /S /Q "C:\Documents and Settings\All Users\Start Menu\Programs\CCleaner"
IF EXIST "C:\Documents and Settings\All Users\Desktop\CCleaner.lnk" (
     DEL /F /Q "C:\Documents and Settings\All Users\Desktop\CCleaner.lnk"

IF EXIST "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\CCleaner" (
     RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\CCleaner"

IF EXIST "C:\Users\Public\Desktop\CCleaner.lnk" (
     DEL /F /Q "C:\Users\Public\Desktop\CCleaner.lnk"
XCOPY %DRIVE%\*.INI C:\IT_Tools\CCleaner /Q

This particular script will map the network share to an unused drive letter on the PC, then install CCleaner to the C:\IT_Tools\CCleaner directory. After installing CCleaner, the Start Menu and Desktop shortcuts will be deleted, and the INI files will be copied to the newly created CCleaner directory. After the deployment is complete, the mapped drive will be removed from the PC.

Once you have deployed CCleaner to your network PCs, you can easily run a silent scan/clean using the following command. This can be placed into a Logon Script, or added as a Scheduled Task.

C:\IT_Tools_CCleaner\CCleaner.exe /AUTO

There you have it. You should now be able to run CCleaner across your entire network, whether it be a home network or a corporate domain.
Subscribe to RSS Feed Follow me on Twitter!