Changing the default power button action to Disconnect in a remote desktop session

I am remoting into my work computer from my computer at home. At home I have Windows 7 Ultimate while at work I have Windows 7 Professional, both 64-bit and with admin privileges.

I would like to change the default action for the power button to Disconnect instead of Log Off but can't seem to do so. That way I won't have to do an extra click on the arrow to disconnect from the session.

the power button

I know that I can change the power button action locally by going to the Taskbar and Start Menu Properties dialog and changing the Power Button action in the Start Menu tab but it is disabled.

the properties page

I was hoping I could change it from the local group policy editor:

User Configuration
    Administrative Templates
        Start Menu and Taskbar
            Change Start Menu Power Button

but it looks like it only makes changes for when connected locally. I don't know where to look in the registry.

the group policy dialog

Is this button configurable for remote desktop sessions at all? Is there a policy/setting that I have to enable to be able to change this?

I would rather not have to use separate scripts just to disconnect if at all possible.

I previously was on Windows XP at work but at least then, the power button defaulted to Disconnect (instead of Shut Down) with the Log Off button right next to it so that was fine with me. I noticed that it is also disabled when remoting to my laptop (also Windows 7 Ultimate). There's a question on E-E asking about the same thing but on Windows Server 2008 and has a single response, doesn't look like it's resolved there though and I'm not going to register for that...


Instead of changing the Start menu which might also not be feasible, you could define a desktop icon that does the disconnection.

Use the tsdiscon command to disconnect the current session :

tsdiscon

The above article is for Windows 2000 Terminal Services (!), but the tsdiscon command still exists and I suppose that it still works. When I tried it, it logged me out but left all my programs still running.


Check this key in the registry:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer

In the right pane of Advanced, double click on PowerButtonAction to modify it.

If PowerButtonAction doesn't exist, then right click on an empty area in the right pane of Explorer, click on New and DWORD (32-bit) Value, type PowerButtonAction, and press Enter.

Type in the Hexadecimal Value data number below for the Power Button option that you want, and click on OK.

For...

Log Off: 1

Lock: 200

Restart: 4

Sleep: 10

Hibernate: 40

Shutdown: 2

The Hibernate option will not be available unless you enable hibernate and have turned off the Hybrid sleep option in the Power Plan Settings. If you are using Hybrid sleep, then you would select Sleep from below.


See if this work?

Local Computer Policy > User Configuration > Adminstrative Templates > Start Menu and TaskBar > Remove Logoff on the Start Menu > Enabled

Also,

Local Computer Policy > Computer Configuration > Administrative Templates > Window Components > Remote Desktop Services > Remote Desktop Session Host > Remote Session Environment > Remove "Disconnect" Option from Shutdown Dialog > Disabled

Finally, remove your user account to connect to the server right's to shutdown the computer.

Local Computer Policy > Computer Configuration > Windows Settings > Security Settings ? Security Options ? Shutdown: Allow system to be shutdown without have to logon > Disabled.

And

Local Computer Policy> User Configuration > Administrative Templates > Start Menu and TaskBar > Remove and prevent access to the Shut Down, Restart, Sleep and Hibernate Command > Enabled

Then the only remaining option should be disconnect.

Use shutdown -i from an remote machine with Admin account if you need to shutdown or reboot it.