Page 1 of 1

Windows Service

Posted: Wed Nov 18, 2020 5:24 am
by laned101
I have created a windows service app with powershell and studio. I have included a few WinForm GUIs to help with configuration etc. I have noticed that now when uninstalling the application it doesn't remove the service from the services list. I can't work out why any help would be appreciated.

Re: Windows Service

Posted: Wed Nov 18, 2020 5:26 am
by jvierra
The most common reason for this is that service has not been shut down properly which prevents it from uninstalling.

Re: Windows Service

Posted: Wed Nov 18, 2020 5:51 am
by laned101
Yes I noticed it's only when the service is active. I thought it would shutdown as part of the uninstall process? Is this not the case? hmm might be able to add that as a custom action during uninstall.

Re: Windows Service

Posted: Wed Nov 18, 2020 5:56 am
by jvierra
If a service cannot be shut down then it cannot be uninstalled.

You cannot run a GUI from a service.

If a service throws an exception it can become hung and cannot be uninstalled. Stop the service and set it to manual. Restart the system and then un install the service.

Re: Windows Service

Posted: Wed Nov 18, 2020 6:08 am
by laned101
My Service code runs separate from my GUI code, the GUI code is packaged as part of the MSI.

When I uninstall the Application from Add Remove Programs, you'd think it would stop the service then remove it. But not to worry I'll write the logic to do it.