Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.

:start
tasklist /fi "imagename eq notepad.exe" | findstr notepad.exe
if %errorlevel%==1 goto end
goto start
:end
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.

share|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
    
Ah. Of course. Thanks. –  mlissner May 20 '11 at 3:38

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.

share|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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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