Policies to limit remote desktop session (RDP) length can be applied per User or to the whole computer.
Here is how to do it on a machine wide policy.
If your machine is part of a Domain
Go to: Computer Configuration\Administrative Templates\Windows Components\Terminal Services
This will work on a Domain environment under Active Directory.
For a stand alone computer:
- Go to Terminal Services Configuration.
- Click on the Connections Folder
- Then right click on the RDP-tcp connection in the righ pane
- Open Properties window
- Click on the Sessions tab
- Tick Overide User Settings checkbox
- Then set time periods for End, Active, Idle
- Check Overide User Settings and click End Session radio button
As per pic below:

www.syncrony.com
By Howard Rybko (june 2009)
The best way to avoid the problem is to institute a Policy that closes open RDP sessions after a set period of inactivity.
The problem with RDP sessions is that users do not remember to close sessions and as a result the max no of sessions will be reached. Sometimes when this happens the server will not allow a new connection to close the old unwated ones. The only way round this problem is either to login from the console and manually disconnect the sessions or to do a manual reboot (power off). The choice of method can come down to a long drive to the data centre versus a "take a chance" power off. You can guess which one usually wins!
On processing, please waiting for ...