MSI Builder Step-by-Step: Services

This final step in our step-by-step series for the SAPIEN MSI Builder shows you how to install Windows Services on the target computer. This applies to Windows Services created with the SAPIEN Script Packager using PowerShell and any other Service executable you have created.

There is currently no limit imposed by the MSI Builder on how many services you can add to one installer.

image

Services to Install

The first step is to create a new service entry and give it a descriptive name. This name should be unique—it should not be similar to any commonly installed Windows Service with the same name. If your name collides with an already installed service with an entirely different function, you may experience unforeseen consequences.

Let’s go through the fields section by section.

Service Properties

  • Name – The descriptive name of your service. It should be unique for the intended target environments and this installer.
  • Display Name – A descriptive term used to display your service in the Services control panel applet, task manager, etc. While there is no requirement to be unique, it is still advisable to make this distinctive and a little more expressive than ‘MyService1’. If nothing is specified here, Windows will use the service name.
  • Service File -The name of the executable containing your service. It must be a file that is installed with your MSI file.
  • Description – Allows you to provide a more verbose description of what this service does. While not required, it is good practice to add some information here.
  • Load Group – Specifies a tag that can be used to group services of similar functionality together. Registry entries can be used to determine the order that services within a group are loaded on system startup; this also applies to the order of groups. This is a more advanced subject that exceeds the scope of this post.

Service Parameters

Error Control

Error Control specifies what to do in case of an error during installation of your service.

  • Ignore – Logs the error and continues with the startup operation.
  • Normal – Logs the error, displays a message box, and continues the startup operation.
  • Critical – Logs the error, if possible, and the system is restarted with the last configuration known to be good. If the last-known-good configuration is being started, the startup operation fails.

Startup Type

Startup Type defines the time when your service is started.

  • Auto – Starts your service when the system starts unless you have load group specifications that indicate otherwise.
  • Demand – The service will start when the Service Control Manager starts it. This can be because a user or program requested the service to start, or another service was started which requires this service as a dependency.

Allow the service to interact with desktop

This option should only be used in extreme circumstances. A message box displayed by a service or some configuration dialog is normally not visible to a logged-on user unless this property is set. Any output a service generates should go to a system or application log. Configuration of a service is generally done via an external tool with a user interface that stores settings in a shared location and restarts the service to make it aware of the changes. Using a UI of any kind within a service is highly unusual.

The service is vital for installation

Selecting this option makes adding the service to the target system and starting it a critical step. If checked, your installer will fail and roll back if the service cannot be added or started during installation.

Account Name and Account Password

Account Name and Account Password specify the credentials used when running your service. Often this is a special user account created for the specific task of the service. If nothing is specified, the service will run under the system account.

Service Control

This section specifies how the installer starts or stops your service during installation. The options for each property are install, uninstall, or both—meaning “install and uninstall” or “none”.

  • Start – This is generally set to ‘install’, which instructs the installer to start your service once added to the system.
  • Stop – This is normally set to ‘both‘. The installer will stop your service before installing or updating and also stop it if the product containing your service is uninstalled.
  • Remove – This is also typically set to ‘both‘. It actually removes your service from the list of available services before install or update operations begin or if your product is uninstalled.

Related

Feedback

If you have any questions or suggestions, please comment below or post in the SAPIEN Support Forum.