Tuesday, August 5, 2008

InstallShield and Windows Services

To add a Windows Service to InstallShield, add the service file into a component. I have my executable as the only file in the component. Right click on the file and set it as the key file. The expand the Advanced Settings tab. There are two sections for NT Services.
In Install NT Services you set the properties. I set the User Name to [SERVICE_USER_NAME] and Password to [SERVICE_USER_PASSWORD]. Then you can set the user in InstallScript using MsiSetProperty.
In Control NT Services you do something very important. You allow the service to be uninstalled properly. You will need to add a service. Then add an event which I am not entirely sure means. But then you have a list of properties for installing and uninstalling. The ones I set to Yes are Uninstall Stop and Uninstall Delete. I also change Wait Type to "Wait for the event to complete".
This allows the service to be uninstalled. However, I did notice that if the services management console is up that the service won't get deleted there. It gets disabled and then gets deleted after the console is closed.

No comments: