Trigger a script when user tries to disconnect remote session (Remote Desktop)

0

We want to run a script when user tries to disconnect a remote session (using Remote Desktop) by clicking the "X (close)" button. Any help on the event that gets triggered on clicking "X/close" button in remote session would also help us. The Script should run before the disconnection is complete. Basically when the system prompts user for confirmation of disconnection. We are using Windows Server 2016.

Bharath Sarma N

Posted 2018-03-12T22:55:20.677

Reputation: 1

(1) If you’re running Windows Server 2016, why did you tag your question [Windows Server 2012] and not [Windows Server 2016]? (2) When you say “when user tries to disconnect”, do you mean that (a) the script should run before the disconnection is complete, and/or (b) the script should be able to prevent the user from disconnecting (I suspect that this will be impossible)? Please do not respond in comments; [edit] your question to make it clearer and more complete. – Scott – 2018-03-12T23:10:13.173

Answers

0

I dont believe this is possible. Hitting the X is closing the application. The user's Remote Desktop application warns the user that this will end the session, but all this is done client side. There is no way for the remote server to know the session is disconnected till it happens and therefore, you couldnt run a script in that manner.

Keltari

Posted 2018-03-12T22:55:20.677

Reputation: 57 019