Link to home
Start Free TrialLog in
Avatar of cpatte7372
cpatte7372Flag for United Kingdom of Great Britain and Northern Ireland

asked on

RDP Exit with Log off Windows 7

Hello Experts,

Can someone let me know if its possible to have an RDP session log off when exiting?

For example, if you exit by clicking the 'X' as shown in the image below

User generated image
You will get the following:
User generated image
However, this doesn't log users off when from a RDP session. I need to either prevent users from using the 'X' or ensuring that using the 'X' results in users logging off.

If neither of the above is possible then a message box which tells users to 'log off' instead.


Cheers
Avatar of HowardPMA
HowardPMA
Flag of United States of America image

If you press the Start button, and go to Windows Security (second column on the right) you will have the option to logout, or restart.
Avatar of cpatte7372

ASKER

Howard,

I don't think you understood me. I'm trying to figure out a way of ensuring that users are logged of when they click the 'X' shown in the image, rather than just being disconnected from the remote session....
Instead of exiting by pressing the x in the RDP bar, you can exit via Windows Security in the RDP session.

Alternatively, you could write a batch file placed on the Public Desktop with the shutdown -l -f -t 3 for 3 second delay. This would log them off. When they log off, the session is killed.
Yeah, but there will always be users that will click 'X' and the disconnect the session :-( I'm trying to prevent that or a way of ensuring that for those users that click 'X' an alternative occurs
Ah. As Ron White said, "There ain't no cure for stupid."
Avatar of NVIT
You can probably use these together:
http://ss64.com/nt/query-session.html
query session /server:Server64

Open in new window

http://ss64.com/nt/reset-session.html
reset session rdp-tcp#6

Open in new window

We had the same problem.  To resolve, we put a shortcut on the user's desktop to "logoff.exe" and changed the icon to something like the MSN butterfly:
User generated image
We just notified users to never use the "X" to close their remote desktop window: we told them to use the butterfly instead.

If this were a terminal server, you could use TSConfig to configure session time out settings, but that's not possible in Windows 7. You have to either edit the registry or use group policy (or local policy) to implement that change.

I would not set the time out period too low because I wouldn't want users to lose work if they were disconnected due to a connection problem & not because they clicked on the "X."

This page describes how to set up time outs for remote sessions in Windows 7 & 8 using local policy settings (domain level group policy settings would be similar):
http://www.sevenforums.com/tutorials/118889-remote-desktop-set-time-limit-idle-sessions.html
I forgot to mention the use of my post https://www.experts-exchange.com/questions/28672870/RDP-Exit-with-Log-off-Windows-7.html?anchorAnswerId=40775465#a40775465

Use it when users forget to use the other expert suggestions and use the "X" anyway.
Thats great,

I don't know who to reward the points to?
I would award points to the Expert whose response helped the most.  You can award points to any Experts who helped by giving them points for assisting.
NewVillage,

I tried the suggestion from the link you provided, but no luck.

Can you let me know what I might be doing wrong?

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Spike99
Spike99
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Alicia,

Thanks for responding. I'm trying to get the RDP session run a batch file when an RDP session starts by configuring the session as shown in the image, but it won't run the batch file when a new session starts.

Any thoughts?
User generated image
Thanks
I've never tried to use that particular GPO setting.
I would just put the shortcut to the BAT file in the STARTUP folder on the server: that way it will run whenever a user logs on.  I believe the path for that in Windows Server 2012 hasn't changed since Server 2008/Windows 7:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

I hope this helps.

Alicia