Silent install of PostgreSQL on Windows

As the PostgreSQL installer for Windows uses Windows Installer (MSI) technology, performing a silent or semi-silent install works the same way as with any MSI installer. It is all done using commandline options to msiexec, which are used to:

All installation is done using the postgresql-<ver>-int.msi file. The main MSI file is just a wrapper around this file that sets some required properties.

Note that the following functions are not available when running a silent install:

If you have any questions regarding silent installations, please use the pginstaller-devel mailinglist available from the pgFoundry page.

Specifying desired user interface level

The following user interface levels are available:

Name Commandline Description
Normal none Normal interactive user installation
No user interaction. "Full size" progress window including progress descriptions.
No user interaction. Just a basic progressbar and not full descriptions. You can also remove the cancel button using
No user information at all.

Specifying features to install

Features to install are specified by adding:


to the commandline. If the ADDLOCAL parameter is not set, the default set of options will be installed.

The following features are available for install (see the wxs/pginst.wxs source for an up-to-date list. This list is accurate per RC1):

Id Description
server Database server
nls Natural Language Support
postgis (8.1,8.2 only) PostGIS Spatial Extensions (installed through Stackbuilder in 8.3+)
pljava (8.1+ only) PL/Java
psql psql commandline utility
pgadmin pgAdmin III
jdbc (8.2 and earlier only) JDBC driver (installed through Stackbuilder in 8.3+)
npgsql (8.2 and earlier only) NPgSql .Net Data Provider (installed through Stackbuilder in 8.3+)
psqlodbc (8.2 and earlier only) ODBC driver (installed through Stackbuilder in 8.3+)
pgoledb (8.2 and earlier only) OLE DB provider (installed through Stackbuilder in 8.3+)
docs (8.0 only) HTML format documentation. 8.1 will always install CHM format documentation.
includefiles C/C++ include files
libfiles C/C++ library files
msvclibs (8.2 and earlier only) C/C++ library files for MS Visual C++ (in main libfiles feature in 8.3 and later)
pgxs (8.2 and earlier only) PGXS
binfiles Development tools and utilities, such as ecpg

Specifying values for properties

Property values are fixed if using any other UI level than Normal. When using Normal, they are taken as default values in the dialogs. Note that string parameters may require quotes (") around the value.

The following properties are available:

Id Default Description
INTERNALLAUNCH 0 This must be set to 1 to be able to use the -int MSI file.
DOSERVICE 1 Install running as a service.
DOINITDB 1 Run initdb on installed system. Only available when installing service. Not available on NT4.
SERVICEDOMAIN . Domain name for service user. For local user, use the name of the computer (%COMPUTERNAME%). If installing on a domain controller, this must be set to the LANMAN domain name (e.g. MYDOMAIN). Only used when installing as a service.
SERVICEACCOUNT postgres Name of service user, excluding domain name. Only used when installing as a service.
SERVICEPASSWORD   Password for service account. The account must already have this password; the installer will not change it. Only used when installing as a service.
CREATESERVICEUSER (8.1+ only) 0 Set to 1 have the service user created during installation, with the specified username and password.
SERVICENAME PostgreSQL Database Server <ver> Name of service in the service control manager. Must be unique on system.
SUPERUSER postgres Account name for default user in database. Only used when running initdb.
SUPERPASSWORD   Password for default user in database. Only used when running initdb.
LOCALE C Locale for database. Only used when running initdb.
ENCODING SQL_ASCII Encoding for database. Only used when running initdb.
LISTENPORT 5432 TCP port to listen for connections on. Only used when running initdb.
PERMITREMOTE   Permit connections from non-localhost machines (set to 1 to enable). Only used when running initdb.
PL_PGSQL 1 Install PL/PGSQL procedural language.
PL_PERL   Install PL/PERL procedural language. Make sure you have the correct perl58.dll available in the system path.
PL_PERLU   Install PL/PERL untrusted procedural language. Make sure you have the correct perl58.dll available in the system path.
PL_TCL   Install PL/TCL procedural language. Make sure you have the correct tcl84.dll available in the system path.
PL_TCLU   Install PL/TCL untrusted procedural language. Make sure you have the correct tcl84.dll available in the system path.
PL_PYTHONU   Install PL/PYTHON untrusted procedural language. Make sure you have the correct python23.dll available in the system path.
PL_JAVA (8.1 only)   Install PL/JAVA trusted and untrusted procedural languages. Make sure you have the correct JRE available in the system path.
NOSHORTCUTS (8.1 only) 0 Don't install any startmenu shortcuts

The following properties are available to change the location of the installation. It is recommended that you only change the BASEDIR and DATADIR properties if that is appropriate for your installation.

Id Default Description
BASEDIR automatically set by Windows Installer Root directory for entire installation.
SERVERDIR BASEDIR Location of server files.
DATADIR BASEDIR\data Location of server data files.
UIDIR BASEDIR Root directory for UI subfeatures.
CBINDIR UIDIR\bin Directory for psql.exe.
PGADMINDIR UIDIR\pgAdmin Directory for pgAdmin III.
JDBCDIR BASEDIR\jdbc Directory for JDBC driver.
NPGSQLDIR BASEDIR\Npgsql Directory for Npgsql .Net data provider. (Some files are also installed in the GAC if .Net Framework is installed)
PSQLODBCDIR BASEDIR\odbc Directory for ODBC driver.
PGOLEDBDIR BASEDIR\PgOleDb Directory for OLE DB provider.
DOCDIR (8.0 only) BASEDIR\doc Directory for documentation.
DEVDIR BASEDIR Directory for development files.

There are some further specific subdirectories available that may or may not work when changed. See wxs/pginst.wxs for a complete list.

Apart from these there is a whole set of properties for which contrib modules to enable. If you want anything other than the default, you will have to look at the source code (wxs/pginst.wxs) for a list of these.

Optionally specify language to use for user messages

To select a language other than english for installation messages, you need to apply an embedded language transform. This is done by specifying the property:
where langcode is the language code for the messages. Available language codes can be found in lang/Makefile.lang. At the time of this writing, support exists for German (de), French (fr), Brazilian Portuguese (pt_br) and Swedish (sv).

A complete example

The following example will install the server, psql and documentation into the file c:\postgres, as a service, with specified username/password. It uses a reduced UI level so we can see the full progress indication, and sets the language to german.

msiexec /i postgresql-8.0.0-rc1-int.msi  /qr INTERNALLAUNCH=1 ADDLOCAL=server,psql,docs SERVICEDOMAIN="%COMPUTERNAME%"
        SERVICEPASSWORD="SecretWindowsPassword123" SUPERPASSWORD="VerySecret" BASEDIR="c:\postgres" TRANSFORMS=:lang_de