Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping A Service In WIX And Starting When Install Is Complete

I'm using WiX 3.5 to create an installer that installs a Windows Service and copies DLL's to the bin directory of a third party app. The third party app has a series of Windows Services also that will need stopped before the DLL's get copied and started after the install is complete. What would I need to do to accomplish this. I have looked for examples, but can only find how to start the service that I'm installing.

***On a side note, the service that I am installing needs to run under a specific user account. I see how to define the Service Account/Password in WIX, but I'm hesitant to use that because it stores the password unencrypted in XML, and I have security concerns with that.

like image 993
TimWagaman Avatar asked Jun 13 '12 16:06

TimWagaman


1 Answers

First off, to stop a service you need to use the ServiceControl element.

<ServiceControl Id="serviceName" Name="actualServiceName" Stop="both" Start="both" Wait ="yes" />

To answer your side not, you can have the username and password be properties that the user sends to the MSI, or that the user enters from the GUI.

<ServiceInstall Id="serviceName" Name="shortName" DisplayName="longName" Type="ownProcess" Start="auto" ErrorControl="normal" Account="[USER]" Password="[USERPWD]" Description="description" />
<Property Id="USER" Value="defaultValue" />
<Property Id="USERPWD" Value="defaultValue" Hidden="yes" />

Of course, the default value is not needed, and not really recommended, but I still put it in there.

like image 82
Christopher B. Adkins Avatar answered Nov 15 '22 11:11

Christopher B. Adkins