Jump to content

Return to Piriform.com

Running CCleaner over a domain to clean profiles


  • Please log in to reply
34 replies to this topic

#21 OFFLINE   fireryone

fireryone

    Lets Get Dangerous

  • Members
  • PipPipPipPip
  • 1,631 posts
  • Gender:Male
  • Location:QLD,Australia
  • Interests:PC, LOTRO

Posted 17 April 2009 - 09:46 PM

link to another domain cleaning resolution:
http://forum.pirifor...showtopic=19066
fireryone

#22 OFFLINE   mbkowns

mbkowns

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 04 June 2009 - 09:57 AM

I wrote an AutoIT script that will parse the profile directory and add lines in the CCleaner.ini file to delete "temp" and "temporary internet files"

This is then just a job that is run in Altiris regardless if users are logged in or out.  I also have it deleting CCleaner off the machine after so I don't have to leave it there.  

#include <File.au3>
#include <Array.au3>
Global $count
FileCopy('\\YOURSHARE\CCleaner\CCleaner.exe', @SystemDir & '\CCleaner.exe', 1)
FileCopy('\\YOURSHARE\CCleaner\portable.dat', @SystemDir & '\portable.dat', 1)
FileCopy('\\YOURSHARE\CCleaner\ccleaner.ini', @SystemDir & '\ccleaner.ini', 1)

;~ Check for docs and settings for profiles
$uList = _FileListToArray('C:\Documents and Settings')
If @error = 1 Then
Exit
EndIf

For $i = 1 To $uList[0]

If $uList[$i] = "All Users" Or $uList[$i] = "Default User" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Then
Else
_Count()
IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temp\|*.*')
_Count()
IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temporary Internet Files\|*.*')
EndIf

Next

$count = 0

RunWait(@SystemDir & '\CCleaner.exe')
FileDelete(@SystemDir & '\CCleaner.exe')
FileDelete(@SystemDir & '\portable.dat')
FileDelete(@SystemDir & '\ccleaner.ini')

Func _Count()
$count = $count + 1
EndFunc   ;==>_Count

#23 OFFLINE   truecolor

truecolor

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 05 June 2009 - 10:13 PM

simulation credit auto
Wow. you're really pofessional on this field.
thanks mbkowns so much for your post ;) :rolleyes:

#24 OFFLINE   mbkowns

mbkowns

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 09 June 2009 - 05:04 PM

View Posttruecolor, on Jun 6 2009, 03:13 AM, said:

simulation credit auto
Wow. you're really pofessional on this field.
thanks mbkowns so much for your post ;) :rolleyes:


Removed the count function didn't need it just how It came out when I wrote it.  So in a nutshell below works with less code.


#include <File.au3>
#include <Array.au3>
Global $count
FileCopy('\\YOURSHARE\CCleaner\CCleaner.exe', @SystemDir & '\CCleaner.exe', 1)
FileCopy('\\YOURSHARE\CCleaner\portable.dat', @SystemDir & '\portable.dat', 1)
FileCopy('\\YOURSHARE\CCleaner\ccleaner.ini', @SystemDir & '\ccleaner.ini', 1)

;~ Check for docs and settings for profiles
$uList = _FileListToArray('C:\Documents and Settings')
If @error = 1 Then
Exit
EndIf

For $i = 1 To $uList[0]

If $uList[$i] = "All Users" Or $uList[$i] = "Default User" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Then
Else
$count = $count + 1
IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temp\|*.*')
$count = $count + 1
IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temporary Internet Files\|*.*')
EndIf
Next


RunWait(@SystemDir & '\CCleaner.exe')
FileDelete(@SystemDir & '\CCleaner.exe')
FileDelete(@SystemDir & '\portable.dat')
FileDelete(@SystemDir & '\ccleaner.ini')

#25 OFFLINE   sandymiss

sandymiss

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 25 June 2009 - 01:49 AM

Thanks so much for sharing the post. :lol:

Edited by Andavari, 25 June 2009 - 02:34 AM.
Hidden spam link removed


#26 OFFLINE   Andavari

Andavari

    .

  • Moderators
  • 15,106 posts
  • Gender:Male
  • Location:U.S.A.

Posted 25 June 2009 - 02:35 AM

sandymiss you are banned for posting a hidden spam link.
Piriform software help documentation is available at:
http://www.piriform.com/docs

#27 OFFLINE   Joines.M

Joines.M

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 23 January 2010 - 01:24 AM

Probably bumping an old thread but here's something for the tech people interested who haven't heard of it yet

http://it.toolbox.co...-for-free-14663

The link describes a defrag over a domain, however I use the same tools for ccleaner, and eset nod32 since both have command line options.

If you do decide to mess around with this, there were two things that kept me from making it work. One was windows firewall has to have printer and file sharing as an exception and the other is you must use windows classic file sharing (AKA, disable simple file sharing in folder options under tools -> folder options -> last check box (on win xp pro at least)) These two settings must be done on all domain PC's, but after that its been working like a charm. And you don't even need to logon each computer to do it :)

#28 OFFLINE   Aaron Bennett

Aaron Bennett

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 12 April 2010 - 05:01 PM

Thanks, I have done this and it works a treat. I have my CCleaner.ini file setup to do the following:

Quote

[Options]
Language=1033
UpdateKey=04/12/2010 10:01:36 PM
(App)Start Menu Shortcuts=False
(App)Desktop Shortcuts=False
(App)Old Prefetch data=True
(App)Menu Order Cache=True
(App)Tray Notifications Cache=True
(App)Window Size/Location Cache=True
(App)User Assist History=True
(App)Custom Folders=True
(App)Wipe Free Space=True
UpdateCheck=0
SecureDeleteType=1
SecureDeleteMethod=3
Include1=PATH|C:\Documents and Settings\|*.*|RECURSE
Exclude1=PATH|C:\Documents and Settings\Administrator\|*.*
Exclude2=PATH|C:\Documents and Settings\All Users\|*.*
Exclude3=PATH|C:\Documents and Settings\Default User\|*.*
HideWarnings=1
AutoClose=1
WINDOW_LEFT=330
WINDOW_TOP=160
WINDOW_WIDTH=620
WINDOW_HEIGHT=450
WINDOW_MAX=0


#29 OFFLINE   goretis

goretis

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 28 May 2010 - 08:46 AM

How safe is this cause when I try to include useraccounts I get the following message

Warning!
This folder will be emptied of all files upon cleaning.
Are you sure you want to do this?


Does this mean that all folders that are inside will be deleted?

#30 OFFLINE   Lord Frog

Lord Frog

    Member

  • Members
  • PipPip
  • 13 posts
  • Gender:Male
  • Location:Ohio, USA

Posted 01 June 2010 - 11:27 PM

Here is a registry patch for the local computer to allow CCleaner to run on all user accounts.

          Launch Regedit by launching the run command and typing regedit.

Navigate to the following key location:
          HKey_Local_Machine\software\Microsoft\Windows\Current Version\Run

Right Click in the right hand window & create a New STRING Value,
          Call it CCLeaner

Double click on the new CCleaner string and put in the following value:
         C:\program files\ccleaner\ccleaner.exe /auto
                   (Note: space between exe and /auto)

I hope this helps.

#31 OFFLINE   mbkowns

mbkowns

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 07 July 2010 - 12:05 PM

I updated my AutoIT script to include VISTA and WIN7 support.  

www.autoitscript.com


Check it out.




#include <File.au3>
#include <Array.au3>
Global $count

_AutoCCleaner()
_GetProfilesCCleaner()


Func _GetProfilesCCleaner()

	FileCopy('\\YOUR_SERVER_HERE\CCleaner.exe', @SystemDir & '\CCleaner.exe', 1)
	FileCopy('\\YOUR_SERVER_HERE\portable.dat', @SystemDir & '\portable.dat', 1)
	FileCopy('\\YOUR_SERVER_HERE\ccleaner.ini', @SystemDir & '\ccleaner.ini', 1)


	If @OSVersion = "WIN_7" Or @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_2008" Or @OSVersion = "WIN_2008R2" Then
;~ Check for folders for profiles
		$uList = _FileListToArray('C:\Users')
		If @error = 1 Then
			MsgBox(0, "", "No Files\Folders Found.")
			Exit
		EndIf

		For $i = 1 To $uList[0]
			If $uList[$i] = "All Users" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Or $uList[$i] = "Public" Or $uList[$i] = "Desktop.ini" Then
			Else
				$count = $count + 1
				IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Users\' & $uList[$i] & '\AppData\Local\Temp\|*.*')
				$count = $count + 1
				IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Users\' & $uList[$i] & '\AppData\Local\Microsoft\Windows\Temporary Internet Files\|*.*')
				_GUICtrlEdit_AppendText($Edit1, @CRLF & "Adding " & $uList[$i] & " Temp + Internet Files... ")
			EndIf
		Next
		$count = 0

	Else

;~ Check for folders for profiles
		$uList = _FileListToArray('C:\Documents and Settings')
		If @error = 1 Then
			MsgBox(0, "", "No Files\Folders Found.")
			Exit
		EndIf

		For $i = 1 To $uList[0]
			If $uList[$i] = "All Users" Or $uList[$i] = "Default User" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Then
			Else
				$count = $count + 1
				IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temp\|*.*')
				$count = $count + 1
				IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temporary Internet Files\|*.*')
				_GUICtrlEdit_AppendText($Edit1, @CRLF & "Adding " & $uList[$i] & " Temp + Internet Files... ")
			EndIf
		Next
		$count = 0

	EndIf

EndFunc   ;==>_GetProfilesCCleaner


Func _AutoCCleaner()
;~ You can add shutdown to the command if you need it.
	RunWait(@SystemDir & '\CCleaner.exe /auto')
	FileDelete(@SystemDir & '\CCleaner.exe')
	FileDelete(@SystemDir & '\portable.dat')
	FileDelete(@SystemDir & '\ccleaner.ini')

EndFunc   ;==>_AutoCCleaner


-MBK (AIM=IllMBKllI)

#32 OFFLINE   michaelpronald

michaelpronald

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 10 May 2011 - 10:50 AM

Thanks for the great posts, guys.

I have the CCleaner Portable version installed on a network drive and I have GPO set up to run it on user start-up. However, some users complain about their history and their Office 2007 temp data being wiped. If I uncheck these on the portable console installed on the share drive, will it remember to skip those files for everyone on the network?

#33 OFFLINE   Tr3bg0D

Tr3bg0D

    Advanced Member

  • Members
  • PipPipPip
  • 305 posts
  • Gender:Not Telling
  • Location:Space

Posted 10 May 2011 - 02:05 PM

Settings for the portable version are kept in the INI file.  So if you execute the same EXE file with the joining INI file and make a change, it will make a change for anyone that uses that EXE file.
Posted Image

#34 OFFLINE   Alan_B

Alan_B

    Super Hero

  • Members
  • PipPipPipPipPip
  • 3,580 posts
  • Gender:Male
  • Location:Lancashire, England

Posted 11 May 2011 - 06:20 AM

View PostTr3bg0D, on 10 May 2011 - 02:05 PM, said:

So if you execute the same EXE file with the joining INI file and make a change, it will make a change for anyone that uses that EXE file.
But it should be fixed if the INI file is write protected.

#35 OFFLINE   Shane G

Shane G

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 02 June 2011 - 10:22 AM

I like the fact that I can clean a users profile via the GPO scripting, however will it work as a LOGOFF script? Most of the content that needs to be removed should be done as soon as their grubby little fingers LEAVE the keyboard :)