Whe a user disconnects from remote desktop setup to automatically logoff inactive remote desktop sessions

Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Terminal Services -> Sessions

Enable ‘Sets a time limit for active but idle Terminal Services sesssions’ and choose your limit

“Click Start, and then click Run. In the Open box, type Gpedit.msc, and then click OK