Restart an RDS server member of a farm


Windows Server 2019

This script allows you to reboot a server RDS member of a farm with a broker session by closing the still open sessions.

Use :

  • Change the two variables $ServerBroker and $ServerHost.
  • Create a scheduled task by running the script on the remote desktop session host server.

Using the script avoids ending up with xxxxx.BACKUP-Y folders in the server’s C: \ Users folder.

During a reboot if UPDs are still mounted a temporary folder is created for each session still open.


The script :




Leave a Comment