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.

  • (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 Mar 12 '18 at 23:10
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.

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