Hi there,
It would appear the script stops and starts the services easily but I've tested this on numerous stalled agents and I get the same response each time. I don't understand. LTSVC.exe is definitely on the machine(s).
I've logged into a stalled agent PC and I can see LTSVC.exe running. Is there a reason why this error could be occurring?
Starting Screen Connect connections to *PC Name Here*, Sending wakeup call
Lets give the wake up call a few seconds to do it's job
Agent Online time in second (if a negitive number then it is the number of seconds offline) -> 76589
Sending Windows commands to restart the LT Agent
Stopping LTService ->
C:\Windows\system32>net stop ltservice
The SADOS Managed Services service is stopping.
The SADOS Managed Services service was stopped successfully.
Killing LTSVC.exe ->
C:\Windows\system32>taskkill /im LTSVC.exe /f
ERROR: The process "LTSVC.exe" not found.
Starting LTService ->
C:\Windows\system32>net start ltservice
The SADOS Managed Services service is starting.
The SADOS Managed Services service was started successfully.
All commands completed.
Edit: I did log on and opened an elevated command prompt and run taskkill /im LTSVC.exe /f manually to test. This succeeded.
Killing LTSVC.exe
Re: Killing LTSVC.exe
This is by design!
We can not consider that the LTSVC will actually respond to a shutdown command. If the LTAgent is "Dead" then some times a restart will not do the trick. So we first try to shut down the agent nicely, if it shuts down then the agent service is currently off when we issue the KILL command. The Kill command will fail (Good) and then we restart the service.
But, If the Shutdown command failed to do that nicely, The LTSVC will still be a stuck process running failed in the background so the Kill command should catch it and stop service. Then nicely restart the service again and service is restored.
So the Kill Failure is actually a good sign that the agent was responding to commands. If you see Kill Succeeded success then you will know that the agent did not respond to a nice call to stop services and we had to hard kill it.
We can not consider that the LTSVC will actually respond to a shutdown command. If the LTAgent is "Dead" then some times a restart will not do the trick. So we first try to shut down the agent nicely, if it shuts down then the agent service is currently off when we issue the KILL command. The Kill command will fail (Good) and then we restart the service.
But, If the Shutdown command failed to do that nicely, The LTSVC will still be a stuck process running failed in the background so the Kill command should catch it and stop service. Then nicely restart the service again and service is restored.
So the Kill Failure is actually a good sign that the agent was responding to commands. If you see Kill Succeeded success then you will know that the agent did not respond to a nice call to stop services and we had to hard kill it.
Re: Killing LTSVC.exe
Ah, okay. That makes sense. Thank you for clearing that up.
As a follow-up question then, so it shows it succeeded but the offline LT agent tab is still showing it offline 10 minutes after refreshing. I pulled the console up and it shows it offline as well. ScreenConnect is online obviously, but I can't query any inventory or anything from the LT agent still.
How long should it take to come back up? It's doing this for all the stalled agents I'm trying on.
As a follow-up question then, so it shows it succeeded but the offline LT agent tab is still showing it offline 10 minutes after refreshing. I pulled the console up and it shows it offline as well. ScreenConnect is online obviously, but I can't query any inventory or anything from the LT agent still.
How long should it take to come back up? It's doing this for all the stalled agents I'm trying on.
Re: Killing LTSVC.exe
Sometimes restarting the agent doesn't fix it and only fix is to reboot agent manually.
Re: Killing LTSVC.exe
I was afraid that would be the answer.
Thank you!
Thank you!