[wix-users] My custom action fails to run sc.exe commands

Tigran Galoyan tigran.galoyan at gmail.com
Thu Nov 3 09:28:29 PDT 2022

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 ~=

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"

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,

More information about the wix-users mailing list