- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- uninstall windows service not removing from services.msc
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
uninstall windows service not removing from services.msc
we have windows service with multi instance support and installer class integrated.
installation is fine, but un-installation removes the folder content but not the service entry from services.msc
please suggest.
Hi @sysadmin-blr ,
If you expand the events section of the service you've added (components section: advanced settings, services, your service), there will be 6 events (you might need to create a new key to see these) - one of which is "Uninstall Delete". The default is no, change it to yes and you'll be good. (I also set Uninstall Stop to yes as well).
Thanks,
Jenifer
Hi @Jenifer ,
thanks for the reply, I am not getting where you want me to add new key, unable to find the event, can you please share some screenshots for the same.
also can you please copy this email to srinivaasan.sundar@enfs.com, there is no option to add cc
Hi,
I got the event where you are pointing, even after giving the flag to true, it is still showing up in services.msc, please suggest
Hi @sysadmin-blr ,
Can you try setting this service file(Eg-Service.exe) as a key file of the component that you had added and give it a try?
Thanks,
Jenifer
Hi @Jenifer,
Thanks for the reply,
sorry i am unable to understand where you want to set this, can you please share some screenshot on where i have to do this.
can you copy srinivaasan.sundar@enfs.com as well?
Hi @sysadmin-blr ,
For any component you can set file(s) as Key file(s) as attached in snapshot.On setting this can you try for uninstalling service whether it works or not?Assuming that you had made settings in events section for service uninstall which i had already mentioned.
Thanks,
Jenifer
hi Thanks for the reply,
i tried earlier all the files are enabled as key file
i disabled and kept only primary output as key file
also under System configuration->Services-[ProductName] is given to support multi instance and the same product name will appear in services.msc.
this suggestion also i am not getting desired output, the service name remains listed in services.msc post uninstallation.
can you suggest how to trigger a batch file upon uninstallation to delete this entry or a better approach will be helpful.
Thanks.
Hi @sysadmin-blr ,
You can add vb-script based custom action which can have code like below:
Set WshShell = CreateObject("WScript.Shell")
Set oWmi = GetObject("winmgmts:")
sWmiq = "select * from Win32_Process where name='servicename.exe'"//Mention the name of the service instead of servicename.exe
Set oQResult = oWmi.Execquery(sWmiq)
If oQResult.Count > 0 Then
For Each oProcess In oQResult
iRet = oProcess.Terminate(1)
Next
End If
Custom action settings can be of:
Return Processing - Synchronous (ignore exit code)
In-Script Execution - Deferred in System context
Exec Scheduling - always execute
After InstallInitialise in Install Exec Sequence
Install Exec condition - REMOVE=ALL
Hope it helps,
Thanks,
Jenifer
thanks @Jenifer
this code looks generic, how to feed the instance name to this vbscript?
is there a sequence we have to follow or just enable run on uninstallation is fine, please suggest.
Hi @sysadmin-blr ,
Just want to add additional information on the uninstallation of services.
1. Sometimes windows does not cleans up the service entry even after removing the service. In this case try restarting windows will clean up the service from Services(services.msc)
2. To Registering and unregistering services the setup should run in administrator mode.
3. If your services is having dependent services you should stop all dependent services before uninstalltion of your main service.
Thanks
Hi @sysadmin-blr ,
Answering to your questions:
how to feed the instance name to this vbscript?-You can add your service name here as mentioned in previous post:
sWmiq = "select * from Win32_Process where name='servicename.exe'"//Mention the name of the service instead of servicename.exe
is there a sequence we have to follow or just enable run on uninstallation is fine?
After InstallInitialise in Install Exec Sequence
Install Exec condition - REMOVE=ALL
Since condition(REMOVE=ALL) is about uninstall it will get executed only on uninstall.Can you try this out and let me know?
Thanks,
Jenifer