INNO Setup - How to install, uninstall, and log silently

This is the 4th of my Packager-Specific Tips & Tricks articles.
INNO Setup is a free installer by jrsoftware.org
It creates self-contained EXE packages.

INNO Setup INSTALL EXAMPLES

Silent INNO install with logging

#IDENTIFICATION: Use 7-Zip to inspect the EXE. It should have 12+ files and one called [0]
#IDENTIFICATION2: Run the EXE with /HELP. A popup should appear. Look at the bottom for jrsoftware.org or INNO
Execute-Process -Path 'TreeSize-x64-Full.exe' -Parameters "/VERYSILENT /SUPPRESSMSGBOXES  /LOG=`"$configToolkitLogDir\$installName_Inno_install.log`""

.
INNO Setup UNINSTALL EXAMPLES

Uninstall using unins000.exe in \ProgramFiles\ with logging

#File Set includes: unins000.exe, unins000.dat and unins000.msg
#INDENTIFICATION: unins000.DAT has 'Inno Setup' inside
#IDENTIFICATION2: Run the EXE with /HELP. A popup should appear. Look at the bottom for jrsoftware.org or INNO
#
#NOTE: INNO uninstall EXE does not create log files by default. But *IF* they do, use this /Log="<path>"
[String]$AppExePath	= "C:\Program Files\JAM Software\TreeSize\unins000.exe"
[String]$AppExeArgs	= " /SILENT /VERYSILENT /SUPPRESSMSGBOXES /SP- /Log=`"$configToolkitLogDir\$installName_remove.log`" "
Execute-Process -Path $AppExePath -Parameters $AppExeArgs -ContinueOnError $False 

Uninstall using unins000.exe with fault tolerance with logging

#File Set includes: unins000.exe, unins000.dat and unins000.msg
#If the unins000.exe is deleted from the C: drive, you cannot uninstall
#INDENTIFICATION: unins000.DAT has 'Inno Setup' inside
#IDENTIFICATION2: Run the EXE with /HELP. A popup should appear. Look at the bottom for jrsoftware.org or INNO
#
#Here we have copied the unins000.exe, unins000.dat and unins000.msg to \SupportFiles\ and use it as a last resort.
#NOTE: INNO uninstall EXE does not create log files by default. *IF* they do, use this /Log="<path>"
[String]$AppExePath	= "C:\Program Files\JAM Software\TreeSize\unins000.exe"
[String]$AppExePathBak = "$dirSupportFiles\unins000.exe"
[String]$AppExeArgs	= " /SILENT /VERYSILENT /SUPPRESSMSGBOXES /SP- /Log=`"$configToolkitLogDir\$installName_remove.log`" "
If (Test-Path $AppExePath) {
	Execute-Process -Path $AppExePath -Parameters $AppExeArgs -ContinueOnError $False 
} Else {
	Write-log "EXE in C:\Program Files\ missing. Using backup copy..." -Severity 2
	Execute-Process -Path $AppExePathBak -Parameters $AppExeArgs -ContinueOnError $False
}
2 Likes