User Tools

Site Tools


userspace:ccleaner325

CCleaner 3.25

Scripts and guide by Soren Birk

For this version i used CCleaner Slim version which can be downloaded from Piriform Builds Page.

The installation file contains both 32 and 64 Bit versions.

Tested with:

  • OPSI 4.0.2.4
  • Winst 4.11.3.3
  • Windows 7, 32 and 64-Bit

Edit the commented section about ini-files if you want to customize the rules for cleaning (how the program cleans the PC).

Take a look at What do ini-files do for more information.

Tree:

CLIENT_DATA
  ├ setup3264.ins
  ├ uninstall3264.ins
  ├ delsub3264.ins
  ├ ccleanerlogo.png
  └ ccsetup325_slim.exe

setup3264.ins

; Author Soren Birk
 
[Actions]
requiredWinstVersion >= "4.11.2.6"
 
DefVar $UninstallProgram32$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $INST_SystemType$
DefVar $INST_architecture$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "ccleaner"
Set $MinimumSpace$    = "10 MB"
Set $InstallDir32$      = "%ProgramFiles32Dir%\CCleaner"
Set $InstallDir64$      = "%ProgramFiles64Dir%\CCleaner"
; ----------------------------------------------------------------
 
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% is needed for " + $ProductId$
	isFatalError
else
	comment "Show productlogo"
	ShowBitmap "%ScriptPath%\ccleanerlogo.png" $ProductId$
 
	if FileExists("%ScriptPath%\delsub3264.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub3264.ins"
	endif
 
	comment "Installing CCleaner"
 
	if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
		Message "Installing " + $ProductId$ + " 32 Bit..."
 
		comment "Start setup program"
		ChangeDirectory "%SCRIPTPATH%"
		Winbatch_install_32
		Sub_check_exitcode
 
		comment "Patching Registry"
		Registry_install /32Bit
 
		; comment "Exporting ini-files"
		; Dosbatch_export_32
 
		; comment "Editing ini-files"
		; Patches_ini_32 $InstallDir32$\inifile.ini
	endif
 
	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		Message "Installing " + $ProductId$ + " 64 Bit..."
 
		comment "Start setup program"
		ChangeDirectory "%SCRIPTPATH%"
		Winbatch_install_64
		Sub_check_exitcode
 
		comment "Patching Registry"
		Registry_install /64Bit
 
		; comment "Exporting ini-files"
		; Dosbatch_export_64
 
		; comment "Editing ini-files"
		; Patches_ini_64 $InstallDir64$\inifile.ini
	endif
 
	comment "Delete desktop shortcut"
	LinkFolder_remove_desktop_link
endif
 
[Winbatch_install_32]
; Change the language by editing the Locale ID
; List of supported LCID's: http://support.microsoft.com/kb/221435
; L=1031 is English
"%ScriptPath%\ccsetup325_slim.exe" /S /D="$InstallDir32$" /L=1031
 
[Winbatch_install_64]
; (To-Do Change LCID)
"%ScriptPath%\ccsetup325_slim.exe" /S /D="$InstallDir64$" /L=1031
 
[Registry_install]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Piriform\CCleaner]
set "UpdateCheck" = "0"
 
[DosBatch_export_32]
; "$InstallDir32$\CCleaner.exe" /EXPORT
 
[DosBatch_export_64]
; "$InstallDir64$\CCleaner.exe" /EXPORT
 
[Patches_ini_32]
; set [property] [parameter]
 
[Patches_ini_64]
; set [property] [parameter]
 
 
[LinkFolder_remove_desktop_link]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "CCleaner"
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

uninstall3264.ins

; Author Soren Birk
 
[Actions]
requiredWinstVersion >= "4.11.2.6"
 
DefVar $UninstallProgram32$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $INST_SystemType$
DefVar $INST_architecture$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "ccleaner"
Set $InstallDir32$    = "%ProgramFiles32Dir%\CCleaner"
Set $InstallDir64$    = "%ProgramFiles64Dir%\CCleaner"
; ----------------------------------------------------------------
 
 
comment "Show productlogo"
ShowBitmap "%ScriptPath%\ccleanerlogo.jpg" $ProductId$
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub3264.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub3264.ins"
endif

delsub3264.ins

; Author Soren Birk
 
 
Set $UninstallProgram32$ = $InstallDir32$ + "\uninst.exe"
 
Set $UninstallProgram64$ = $InstallDir64$ + "\uninst.exe"
 
if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	Message "Uninstalling " + $ProductId$ + " 32 Bit..."
 
	if FileExists($UninstallProgram32$)
		comment "uninst.exe found, starting uninstallation"
		Winbatch_uninstall_32 /WaitforProcessending "Au_.exe" /Timeoutseconds 10
		sub_check_exitcode
	endif
endif
 
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
	Message "Uninstalling " + $ProductId$ + " 64 Bit..."
 
	if FileExists($UninstallProgram64$)
		comment "uninst.exe found, starting uninstallation"
		Winbatch_uninstall_64 /WaitforProcessending "Au_.exe" /Timeoutseconds 10
		sub_check_exitcode
	endif
endif
 
[Winbatch_uninstall_32]
"$UninstallProgram32$" /S
 
[Winbatch_uninstall_64]
"$UninstallProgram64$" /S
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
userspace/ccleaner325.txt · Last modified: 2021/08/23 08:37 (external edit)