0

I'm creating an installer using wix and I need to stop a service during uninstallation. Here's my type 34 custom action:

<CustomAction Id="StopNP" 
              Directory="SystemFolder" 
              Execute="commit" 
              Return="ignore" 
              ExeCommand="[SystemFolder]cmd.exe net stop RemindexNP"/>

This is simply opening cmd.exe without running the commands I gave. Does anyone know how to actually run the 'net stop ' command in command prompt?

I've also tried these two custom actions together, with the same result:

<CustomAction Id="SetPathToCmd" Property="Cmd" Value="[SystemFolder]cmd.exe"/>
<CustomAction Id="StopNP" Property="Cmd" ExeCommand="net stop RemindexNP"/>

Any suggestions would be greatly appreciated

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
user2437443
  • 2,067
  • 4
  • 23
  • 38
  • 1
  • That seems to have worked, thanks a lot! I have another similar custom action that runs a .exe file and should pass some parameters through the ExeCommand attribute. The parameters are not working on that either: `` I was wondering if you could lend your expertise on this issue as well? – user2437443 Aug 27 '13 at 23:21
  • How exactly are they "not working"? Have you tried running the (un)installer with verbose logging enabled? – Ansgar Wiechers Aug 27 '13 at 23:24
  • Yes I have. There are no errors in the log. The executable is running but without the parameters, just like the first custom action I posted. Taking out [SystemFolder] in ExeCommand worked for that custom action, but the second custom action is a different type so that fix won't work. – user2437443 Aug 27 '13 at 23:53
  • 1
    Are you sure that the `FileKey` value is defined correctly and `instsrv.exe` (still) exists at that point of the uninstall? Have you tried using `sc delete RemindexNP` instead of `instsrv RemindexNP remove`? – Ansgar Wiechers Aug 28 '13 at 10:00
  • If FileKey weren't defined properly, it would throw an error I think. instsrv.exe must exist, because I'm running the custom action before RemoveExistingProducts. I tried sc delete RemindexNP and that worked, so thanks a lot! However, I have a custom action that creates the service on install, and that one has to use instsrv.exe as well as srvany.exe. So I still need to figure out how to pass parameters to instsrv.exe. I think it's time to start a new question for that though. If you want to make your first comment into an actual answer, I'll mark it as accepted. – user2437443 Aug 28 '13 at 18:16
  • Here's the new question: http://stackoverflow.com/q/18495579/2437443 – user2437443 Aug 28 '13 at 18:30

0 Answers0