[wix-users] How to stop a service before install

Bob Arnson bob at firegiant.com
Fri Jan 22 10:27:23 PST 2016

You know the answer, Pete. Search your feelings, you know it to be true. :) A log will have the answers:

1. Check the log for the component id. That will show you if the component is getting scheduled for installation.
2. Check the log for the service name. That will show you if the service is getting scheduled for stopping.

FireGiant  |  Dedicated support for the WiX toolset  |  http://www.firegiant.com/

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Furtado, Peter (GE Healthcare)
Sent: Thursday, 21 January, 2016 19:26
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] How to stop a service before install

I'm trying to stop a service prior to an upgrade. This service was not installed by any components in the package, it was created by a manual step after the package is installed, and it uses files that are installed by the package.

I tried using this:
<Component Id="Comp_StopStartPlayService" Feature="AdminWebServer" Directory="TARGETDIR" Guid="36F335A9-26BA-4BA0-9F16-2F65124C4D5B" KeyPath="yes" Permanent="no" > <Condition><![CDATA[PLAYSERVICEINSTALLED <> 0]]></Condition> <ServiceControl Id="StopStartPlay" Name="AdminConsoleUI" Stop="both" Wait="yes" /> </Component>

And it doesn't stop the service, and I get a file in use warning that I will have to reboot if I continue.

The name of the service is correct.
The feature is being installed (upgraded)

I tried using a WixCA custom action to run the command "sc stop AdminUI", but I couldn't sequence it before InstallInitialize (it complained), and I think that is too late?
<CustomAction Id="StopAdminUiService_cmd" Property="StopAdminUiService"  Execute="immediate" Value="sc stop AdminUI" /> <CustomAction Id="StopAdminUiService" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="asyncWait" Impersonate="no" /> <InstallExecuteSequence>
<Custom Action="StopAdminUiService_cmd" After="CostFinalize" /> <Custom Action="StopAdminUiService" After="InstallInitialize"> <![CDATA[PLAYSERVICEINSTALLED <> 0]]>

Any help or ideas would be appreciated.

Pete Furtado
GE Healthcare
Staff Software Engineer
T   802-859-6028
E   pete.furtado at ge.com<mailto:pete.furtado at ge.com>
40 IDX Drive
South Burlington, VT, 05403-7771, USA
General Electric Company, GE Healthcare

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list