Using Services Configuration

Services configuration enables the Windows Installer to customize the services on a computer. Developers can author a Windows Installer package to install, stop, start and delete services during an installation by using the ServiceControl and ServiceInstall tables and the InstallServices, StopServices and DeleteServices actions.

Beginning with packages written for Windows Installer 5.0, developers can also use the MsiConfigureServices standard action and the MsiServiceConfig table to configure the extended service customization options available with Windows 7 and Windows Server 2008 R2 and Windows Vista and Windows Server 2008. Existing installation packages written for versions of the Windows Installer that did not include the MsiServiceConfig table can be still be installed using Windows Installer 5.0. The services configuration feature of the Windows Installer cannot configure network service accounts, install shared service host (svchost) processes, or restart services stopped as part of the installation.

Windows XP and Windows Server 2003 or earlier: Not supported. The service configuration tables and standard actions are available beginning with Windows Installer 5.0 running on Windows 7 and Windows Server 2008 R2 and Windows Installer 4.5 running on Windows Vista and Windows Server 2008.

You must include the MsiConfigureServices action in the InstallExecuteSequence table to request the service configurations that you specify in the MsiServiceConfig table. The Windows Installer uses the information in the MsiServiceConfig table only when the MsiConfigureServices standard action is included in a sequence table. The MsiConfigureServices standard action also uses information in the ServiceControl and ServiceInstall tables.

To request that the system give only required privileges to a particular service, specify the service and the SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO configuration option in the MsiServiceConfig table. Remove the unneeded privileges from the service's process token. This option can be used to configure services run in the security context of the LocalSystem, LocalService, or NetworkService service user accounts.

To request that the system delay the automatic start of a service for a time after the start of all other auto-start services, specify the service and the SERVICE_CONFIG_DELAYED_AUTO_START option in the MsiServiceConfig table. The service being delayed must be installed by the current package with SERVICE_AUTO_START specified in the ServiceInstall table or the service must already be installed as an auto-start service.

To request that the system reserve a resource for the exclusive use of a particular service, specify the service, the service SID type, and the SERVICE_CONFIG_SERVICE_SID_INFO configuration option in the MsiServiceConfig table. Add the service's SID to the resource's Access Control List (ACL) for the resource.

To request that the Service Control Manager (SCM) wait after sending the SERVICE_CONTROL_PRESHUTDOWN notification to a service, do the following. Specify the service, the length of time the SCM should wait, and the SERVICE_CONFIG_PRESHUTDOWN_INFO configuration option in the MsiServiceConfig table.

To configure when the system should run actions after the failure of a service, specify the service and the SERVICE_CONFIG_FAILURE_ACTIONS_FLAG option in the MsiServiceConfig table. Add the actions to be run to the MsiServiceConfigFailureActions table.

For more about the extended service customization capabilities introduced with the Windows Vista and Windows Server 2008 operating systems, see Service Changes for Windows Vista.