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.

tasklist /fi "imagename eq notepad.exe" | findstr notepad.exe
if %errorlevel%==1 goto end
goto start
echo %date% %time% The [name of process] is complete on %computername% >> \\unc\sharename\filename.txt
shutdown /l

That way you're RDP session will be logged out and you'll have a log file of when it finished.

| improve this answer | |
  • This looks like the simplest solution. It still needs a notification method aside from shutting down the machine (like sending an email, for example), but I suppose it will do. – mlissner May 17 '11 at 3:33
  • shutdown with the /l command will only log the RDP session out. It won't turn the computer off. The echo command before it will write to a log file of your choice. You can check that daily, or hourly to see if anything has finished. Change the [name of process] to whatever you have listed. – Nixphoe May 19 '11 at 21:49

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.

| improve this answer | |

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.