WebListener
WebListener copied to clipboard
Add the ability to run WebListener as a Windows service
I'd like to figure out how to allow WebListener to run as a Windows service, so that it could be started and left to run in the background without a user needing to be logged in.
Interested in any ideas or feedback that anyone might have on how to accomplish this.
Hi @cofonseca, I have a couple of ideas on how to get your WebListener running as a Windows Service. I will see what I can do when I get home.
I found an article on https://msdn.microsoft.com/en-us/magazine/mt703436.aspx
I will see what I can do with it in the following week.
Excellent @CodeBarbarian , thanks! No rush on this at all - it's a pretty low priority for me.
I came across the same article a few days ago but haven't really had time to dig into it. I'm very interested to see what you come up with. Feel free to reach out if there's anything I can assist with.
I tried using the NSSM at http://nssm.cc/
Start-Process -FilePath .\nssm.exe -ArgumentList 'install YourServiceNameHere "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-command "& { . C:\Scripts\WebListener\Start-WebListener.ps1; Start-WebListener }"" ' -NoNewWindow -Wait
It works.
NSSM is a service helper that could do exactly what you need. If you rather would like to add legacy service support, it would be by using the article mentioned in the comment from msdn.
Awesome. I'll give it a try this weekend and see how it works out.
What do you think would be the better solution long-term in regards to someone using WebListener for a small project? Downloading NSSM and getting it set up doesn't seem to be difficult, but would take a few extra steps for a user who wanted to use WebListener as a service. Legacy service support would take more work up-front, but would make WebListener easier to use going forward.
I'll try to do a bit more research this weekend but maybe we just add some documentation on how to use this with NSSM in the meantime, and shoot for service support in the future. Thoughts?
Optionally we could try using the New-Service Cmdlet in Powershell?
Optionally we could try using the New-Service Cmdlet in Powershell?
You still need to have ServiceManagement functions, for the OS to recognize it as 'service'
NSSM is a great tool, but if you don't want to use it (or can't for any reason), you can have almost 'service'-like experience with Task Scheduler. You will only miss service management functions.
Another option would be to start the powershell script from task scheduler when the computer starts.