At my job, I often perform tasks on remote Windows machines using RDP. These tasks can take a long time to finish (hours/days/weeks), so I end up with many RDP sessions open simultaneously, each with a task running.
The problem I have is that I have to monitor each of these RDP sessions in order to know when the task finishes, and that takes a lot of my time/energy.
What I'd like is some sort of alert. Any of the following would make useful triggers:
- the RDP session becomes quiet (because logs stop scrolling by)
- the logs stop scrolling (this could be a remote log monitoring tool that emails me?)
- a certain word appears in the log, such as "complete" (this might be the best solution)
- there's no activity in the RDP window for x amount of time
- something else?
It seems like such tools must exist in the Windows world, but I haven't found them.
You can do this via a batch file using tasklist. You can change it to the process ID or what ever process you're using to monitor it. Obviously sub notepad.exe for whatever the name of the process you're using is.
That way you're RDP session will be logged out and you'll have a log file of when it finished.
I am not sure if it will work for RDP window contents, but the AutoIT scripting engine is capable of waiting for certain keywords to appear within a window - you might want to give it a try.
Using RDP is certainly one way to execute tasks but I would suggest that you instead implement a WMI script or a powershell script to start the process and either poll the logs periodically (logparser, powershell any tool will do), or have the script you run send the logs to you on process exit. I would suggest posting a question about how to automate what you are currently manually doing.