[wix-users] My custom action fails to run sc.exe commands
Bob Arnson
bob at firegiant.com
Thu Nov 3 12:39:20 PDT 2022
Or just use MSI's built-in support for services and not write any code at all?
> -----Original Message-----
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
> Herman van Drie via wix-users
> Sent: Thursday, 3 November, 2022 15:24
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Cc: Herman van Drie <hvandrie at outlook.com>
> Subject: Re: [wix-users] My custom action fails to run sc.exe commands
>
> As you're already executing from C# why not also write some (un) managed
> code to stop, delete services from code instead of firing processes like SC -
> which executes async without waiting for service action to complete.
>
> Sent from Surface Duo
> ________________________________
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Nir
> Bar via wix-users <wix-users at lists.wixtoolset.org>
> Sent: Thursday, November 3, 2022 7:48:39 PM
> To: wix-users at lists.wixtoolset.org <wix-users at lists.wixtoolset.org>
> Cc: Nir Bar <nir.bar at panel-sw.com>
> Subject: Re: [wix-users] My custom action fails to run sc.exe commands
>
> 1062 = ERROR_SERVICE_NOT_ACTIVEThe service has not been started.--Nir
> BarWiX Expert ---- On Thu, 03 Nov 2022 18:28:29 +0200 wix-
> users at lists.wixtoolset.org wrote ----Hello Community,
>
> I have a custom action that is being run during the uninstall just before the
> removal of files:
>
> *<Custom Action="CA_DeleteWindowsServices"
> Before="RemoveFiles">REMOVE ~=
> "ALL"</Custom>*
>
> And here is the declaration of my custom action in my main wxs file which
> defines it as a deferred with impersonation set to NO:
>
> *<CustomAction Id="CA_DeleteWindowsServices" Return="check"
> BinaryKey="ESInstallerCustomActions"
> DllEntry="CAM_DeleteWindowsServices"
> Execute="deferred" Impersonate="no" />*
>
> The custom action implementation (C#) is quite simple, it just deletes some
> windows services using the command "sc.exe delete my_service_name"
> (Process.Start).
>
> The thing is, that on some computers it runs well and on some computers it
> fails to delete the services, and when I check the installer log, where I trace
> the exception if deletion fails then I see this logged error:
>
> *Network shell process exited with code1062*
>
> Any ideas what I need to do or what I am missing? If needed I can share the
> code for the custom action as well, although as I mentioned it's a simple code
> using sc.exe delete option.
>
> Thanks in advance,
> Tigran
>
> ________________________________________________________________
> ____
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ________________________________________________________________
> ____
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ________________________________________________________________
> ____
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
More information about the wix-users
mailing list