Skip Ribbon Commands
Skip to main content
WinSCP uses InnoSetup as it's packager:
 
Good documentation is provided by the publisher on how to automate installation:
 
Running Install Silently:
We can create an unatteneded installer by first running the publisher's installer using the "/SAVEINF=" parameter.  This will capture our installation selections to the file specified.  We then can call the installer using "/LOADINF=" and "/SILENT".
 
Customizing the Installer:
I decided to use the "ini file" option for adding custom configurating settings to the installer.  INI files allow us to install all applications settings in a single file named "WinSCP.ini" that can be dropped into the %ProgramFiles%\WinSCP directory at install time.  When the file is present, WinSCP automatically stops using the registry for storage of settings.  For users of XP, this will not be a problem as long as they are running as a local Administrator.  However, to avoid problems, we use a CACLS command to change permissions on the WinSCP.ini file on the XP platform.  For Vista users, UAC will altomatically redirect ini file write requests to the user's "Virtual Store" folder in %userprofile%\AppData\Local\, so the CACLS command is not necessary.
Generating the WinSCP.ini file:
To generate the WinSCP.ini file, we install WinSCP then use the "Preferences" GUI to configure the application to our needs.  All I really did was add a "zoo" profile, set the theme to "Office 2003", and tune down the "automatic update" settings to once per month.  We then click "Export" in the preferences dialog and save as file "WinSCP.ini".  We open the file and edit out all but the non-default settings (I used "WinDiff" from the Server 2003 resource kit to find all files that have changed from a default install).  We should end up with something like this:


[SshHostKeys]
dss@22:zoo.uvm.edu=<BigLongStringOfNumbers>

[Configuration\Interface]
PuttySession=WinSCP%20temporary%20session
PuttyPath=%25PROGRAMFILES%25%5CPuTTY%5Cputty.exe
PuttyPassword=0
Theme=Office2003
Interface=0

[Configuration\Interface\Updates]
Period=30

[Sessions\Default Settings]
PingType=0
HostName=zoo.uvm.edu

[Sessions\zoo.uvm.edu]
HostName=zoo.uvm.edu
PingType=0

Installation Script:

@echo off
REM Unattended installation script for WinSCP
REM Includes UVM Custom Settings file
REM JGM: 2007-04-09
 
:install
start /wait winscp_setup.exe /loafinf=uvm_setup.inf /silent
 
:customize
copy /Y /V WinSCP_cmdr.ini "%ProgramFiles%\WinSCP\WinSCP.ini"
 
:OSVer
REM Determine current OS Version
set OSVer=noSup
ver | find /i "5.1." && set OSVer=XP
ver | find /i "6.0." && set OSVer=Vista
IF %OSVer%==XP GOTO XPCacl
IF %OSVer%==Vista GOTO noCacl
IF %OSVer%==noSup GOTO unsupported
 
:XPCacl
cacls "%ProgramFiles%\WinSCP\WinSCP.ini" /e /g users:W
goto end
 
:noCacl
echo Since this computer is running Vista, UAC will handle required changes to the WinSCP.ini file.
goto end
 
:unsupported
cls
ECHO The software was installed successfully, but...
ECHO .
ECHO We were unable to determine your OS type.  As a result, you may not be able to edit your WinSCP profile settings unless you have administrative rights on this system.  To avoid problems, you can change the ACL on the %ProgramFiles%\WinSCP\WinSCP.ini to allow all users R/W rights to the file, or you can delete WinSCP.ini and force users to rely on HKCU to store their preferences.
Echo .
ECHO Upgrade to Windows Vista or XP Professional for full support from ETS.
pause
GOTO END
 
:end