Uninstall a service in with Multiple instance feature
Hi, I have a problem in multiple instance when uninstalling one of the instance. Everything get remove properly except for the service in windows service. The files, folder, entry in add/remove program are getting remove but not the service. I have set a key file on my sercice executable and set the uninstall event to uninstall stop and uninstall delete. I have also set the wait type to wait for the event to complete. All of my component are set to not be share.
Is there something I am missing or is this and install shield/msi bug for multiple instance msi. In my log file it doing the event for stoping and deleting services, but I think it does not look for them with the proper service name since I change it on install.
Anyone face that issue?
I am experiencing this same issue. If I uninstall the initial instance, the service is properly removed. If it's a multi-instance installation, the Windows service remains on uninstall. Did you find a resolution?
We managed to find a solution, but it is a little bit complicated. Maybe there are better / easier ways to resolve the problem.
Here is what we’ve done:
- We created a vbscript file that stops and uninstalls the service and added it to the package. Here is the code
On Error Resume Next
Set objWshShell = CreateObject("WScript.Shell")
objWshShell.Run "sc stop <YourServiceInstanceName>",0,true
objWshShell.Run "sc delete <YourServiceInstanceName>",0,true
Set objWshShell = Nothing
- Then we added to Text File Changes a replacement rule in order to replace <YourServiceInstanceName> with the specific service instance name.
NOTE: This is a unique service identifier that you use. It may be different from service display name.
- After that we created a custom action to call the VBScript file and added it to Exec Sequence after InstallValidate with condition REMOVE=”ALL”
- In service definition in components > advanced we removed events to stop and uninstall the service, because now it is done with the script mentioned above. That’s important, because when uninstaller can’t find a service on uninstallation, it requires reboot.
That’s it. Hope it helps.