Description:
Upon restart of the agent, Job Status is fail if the script of command finished while the System Agent is down on Windows
Solution
When the agent is stopped and brought back to active state, it tries to attach to all the processes it spawned before it went down. The agent obtains this information is obtained from the database files. While attempting to attach to the process, if the process is up and running the agent will be able to attach and get the process details successfully and report back the status of the job successfully to the scheduler, else it will fail with lost control failure message. In this case the client's command/process have ended when the agent is back to active state and therefore it has no chance to attach to the processes and hence fails with the message Lost control.
This behavior is for Windows.
On Unix/Linux the design of the agent is different and it is able to get the job status.