![]() This is working for Windows Server 2008 R2 and Windows Server 2012. This can then be added to an elevated scheduled task that runs every X minutes to check for disconnected users. I also wanted it to connect to multiple servers and be able to list specific users to be logged off. I saw it didn’t really need to write to a temporary file, and just use internal variables. It uses “ quser” to get the list of logged on users, writes them to a file, finds the ones that are disconnected and uses “ rwinsta” to log them off. Select the RDS Collections In the HOST SERVERS section, select a server you want to enable the Drain Mode for and select Do not allow new connections in the context menu. I found this command-line code to log-off all disconnected users. Open Server Manager -> All Servers -> and add all RDS servers of the farm Select Remote Desktop Services on the left panel in the Server Manager. Whether it is set to log-off disconnected users at 1 minute or 5 minutes, during isolated tests it works fine, but when in production it has failed multiple times in the last few months with disconnected sessions lingering for hours before noticed. However I have found this feature to be unreliable. Windows has this feature built-in, you can find it at the user-properties “Sessions” tab. I would like to log-off some users after they have disconnected. More information about Remote Desktop Services can be found here.
0 Comments
Leave a Reply. |