This script allows you to reboot a server RDS member of a farm with a broker session by closing the still open sessions.
- 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 :