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

Furtado, Peter (GE Healthcare) pete.furtado at ge.com
Thu Jan 21 16:26:22 PST 2016


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.

PLAYSERVICEINSTALLED is not equal to 0.
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]]>
                </Custom>
                ....
</InstallExecuteSequence>

Any help or ideas would be appreciated.

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



More information about the wix-users mailing list