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 :

Romain Drouche
System Architect | MCSE: Core Infrastructure
IT infrastructure expert with over 15 years of field experience. Currently a Systems and Networks Project Manager and Information Systems Security (ISS) expert, I use my expertise to ensure the reliability and security of technological environments.

Leave a Comment