ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Uninstall a service

So appreciate the help with other questions so far. Though even turning on all the checks on my notifications setting I have no idea when a reply is made to my post besides manually checking every few hours. So if we could fix that, that would be cool.


This issue is resolved. I found a thread that made a mention of some other issue but it worked for mine. Though it would be awesome to know the answer to the first issue.

I just subscribed to this post so maybe that will help. Though if thats the case it should automatically subscribe you to your own posts. :D

Now for what I care about. I have spent about a day trying to debug this issue and still not entirely sure how to go about fixing this.
Expected process upon uninstall:
Uninstall batch file ran to remove service.
Files removed and env vars
Uninstall done.

Heres the actual.
Files and env vars removed
Batch file trying to be ran but its been deleted
Uninstall fails, must force uninstall.

How do I go about making sure my batch file is ran before it is deleted?
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Uninstall a service

Hello,
Though it would be awesome to know the answer to the first issue.
I am not quite sure what issue you are mentioning here. Could you please point me to it so I can try and help?
Batch file trying to be ran but its been deleted
This might happen if your custom action is scheduled after the "Remove Resources" action group ("Custom Actions" page --> "Install Execution Stage").

A solution to this would be to add your .BAT file as a temporary file in the "Files and Folders" page and also checking the "Do not remove the file when setup ends" option for that .BAT file. This way, at the beginning of the installation, the .BAT file will be extracted in the %temp% folder and it can be used during both install and uninstall process.

After doing so, simply create a "Launch File" custom action, where you can point to your .BAT file as it follows:

Code: Select all

[&myBatFile.bat]
This custom action will launch your .BAT file into execution.

Now, we would like the .BAT file to execute only during uninstall. To do so, simply scroll down to the "Execution Stage Condition" section and uncheck the "Install" and "Maintenance" options.

One more thing would be to schedule your custom action after the "Remove Resources" action group with its execution time being of "When the system is being modified (deferred)" (under "Execution Time" section).

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Re: Uninstall a service

Actually for the batch file I had it under the deferred option. I switched it over to immediately and that resolved the issue.

As for my first issue it was the notifications not working. Today they worked better than previously. However, I had a reply on two posts. This one I had a notification for. But my other post that was also replied to did not give me a notification.
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Uninstall a service

Hello,
I switched it over to immediately and that resolved the issue
I am glad you got this working.
This one I had a notification for. But my other post that was also replied to did not give me a notification
I am not quite sure why this happens. Probably, you have to enable notifications for each of your post in order to be notified.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”