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)