poshbotio / PoshBot

Powershell-based bot framework
MIT License
536 stars 108 forks source link

poshbot not working when running as a service. #210

Closed poseyjmac closed 4 years ago

poseyjmac commented 4 years ago

I got poshbot working by running 'C:\poshbot\start-poshbot.ps1' from a powershell window. Bot lights up in Slack, commands work great.

Then I followed the tutorial to run this as a service (https://poshbot.readthedocs.io/en/latest/guides/run-poshbot-as-a-service/), but the bot is not available in Slack after the service is created and ran, and I'm unsure how to troubleshoot it. My path is exactly the one in the tutorial and I ran everything exactly as shown.

I'm running Powershell 5.1 on Windows Server 2012 R2 Standard. I've tried both 32-bit and 64-bit nssm executables.

DunlapOverbelt commented 4 years ago

@poseyjmac is there a space in any of your paths for $nssm, $ScriptPath, $ServiceName, or $ServicePath?

Is the location of $ScriptPath accessible by SYSTEM?

Have you tried running the service as your account or a specific account for poshbot, confirming it has access to read and write to the $ScriptPath?

poseyjmac commented 4 years ago

It has access as far as I can tell. I got this to work on a Windows 10 client machine.

One thing that's weird that may be related is the bot will just disappear from chat randomly and never return. This is after running it from a Powershell console window. I can't get it to be reliable running from there, so it not working at all as a service is less shocking