Krishnakant Dalal
Krishnakant Dalal

Reputation: 3578

Run s/w on closing of Remote Desktop Connection

I want to run an application on closing/Disconnecting Remote Desktop Connection. Is there's any way to keep record of Remote desktop session start-stop timing in winndows xp/win 7.

Upvotes: 3

Views: 1142

Answers (3)

Bartek Jablonski
Bartek Jablonski

Reputation: 2737

You can run any program using Task scheduler:

  • When the computer enters an idle state.
  • When the system is booted.
  • When a user logs on.
  • When a Terminal Server session changes state.

You can even add tasks from command line

Upvotes: 0

Luke
Luke

Reputation: 11421

You can write a Windows service and listen for SERVICE_CONTROL_SESSIONCHANGE. One of the parameters for that event is the session state, which in this case you would be interested in either WTS_SESSION_LOGON/WTS_SESSION_LOGOFF or WTS_REMOTE_CONNECT/WTS_REMOTE_DISCONNECT depending on your needs.

Upvotes: 5

vikiiii
vikiiii

Reputation: 9476

On start of remote desktop connection you can try this. Here is a psuedo-code of what you have to do:

  1. Java application (Listener), registered as a Windows Service and runs on system stratup.

  2. Listener application keep listening until some .exe file is opened. (Here in this case It will be mstsc.exe)

  3. Listener execute code (or call another application)

Upvotes: 0

Related Questions