Logging off RDP users RRS feed

  • Question

  • I have several RDS servers that numerous users connect to. (MS Server 2016 and 2012) Everyday at 5:05PM, we have to "logoff" certain users from their sessions. I use Remote Desktop Services Manager to see all the users connected to RDS servers. Manually I CTRL and select the users I need to logoff. Then right-click and Logoff. Works fine. However,

    I want to automate this process and haven't found a way to do so using the following criteria:

    1. Needs to be by username. Session ID will change. Username doesn't.

    2. I can build a list of usernames (that will be edited as users come in and out of the criteria for logoff - i.e. salespersons come and go)

    3. Would like some sort of script that references the usernames on the list then searches for RDP connections they may have.

    4. If found, the user will be logged off their session. 

    NOTE - CANNOT "kill" or "reset" the connection. Logging off allows the software they're using on the remote server to be properly closed before dumping the session.

    5. This script process can be Task Scheduled on each of the remote servers and set to execute at 5:05PM daily (M-F) or it can look for these users and perform the logoff via the Remote Desktop Services Manger on my PC..

    Open to any ideas. 

    Thanks in advance for any suggestions.


    Wednesday, November 13, 2019 10:10 PM

All replies