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

14

3

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...

Jeff Mercado

Posted 2012-05-20T22:47:47.020

Reputation: 532

9What's wrong with the 'x' button at the top of the remote desktop window? By using the Start Menu power button you risk accidentally shutting down the computer. – James P – 2013-03-18T12:46:13.483

@James, no he doesn't. Generally when you use the Start Menu on a remote machine, Shutdown and Restart are not available (you have to issue the shutdown command if you really want to do it.) – Windos – 2013-03-20T01:35:51.233

1@Windos: It depends on the specific version of Windows. For instance, if I open an RDP session to Windows Server 2008 terminal services the "power" button on the Start menu shuts down the computer. On Windows 2003 there is a shutdown button and a log off button. Maybe this is not the same on desktop Windows versions but I still don't see the point in using the Start menu over the 'x' button at the top. – James P – 2013-03-20T09:31:22.813

1@James: This isn't too much of a concern at the moment but IIRC, the main motivation for this was consistency. When finished with a remote desktop session, most of the time I want to just disconnect, others I needed to completely log off and I occasionally need to reboot. To be able to do all that, the start menu allowed me to do all. XP had a disconnect button along with log off so it was perfect then. That plus running VMware that has a similar interface, I have scripted shutdowns to do much more than that. I'd rather not have to worry about which program I'm using when I just want to quit. – Jeff Mercado – 2013-03-20T20:28:54.617

2Ctrl-Alt-End, then Alt-L. Get into the habit of this, and you never accidentally shutdown a machine ever again. – Michael – 2013-05-15T02:41:48.153

I just hope my operators can consistently doing that. Obviously not, they are "fresh" staff every months. – None – 2013-07-29T16:07:55.217

Answers

3

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.

harrymc

Posted 2012-05-20T22:47:47.020

Reputation: 306 093

2

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.

Milad Abooali

Posted 2012-05-20T22:47:47.020

Reputation: 209

i guess he asking for disconnect. will there be a hex value for it ? – None – 2013-07-29T16:00:15.030

No, There is not !
for this action we have easier solutions then change power button...
– Milad Abooali – 2013-07-30T12:50:09.653

1

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.

user218473

Posted 2012-05-20T22:47:47.020

Reputation:

1i actually recall that we once have a legacy answer program which have to remain login, everytime the operator goes in checking log and accidental logoff, all the voice channel are dead. – None – 2013-04-30T14:59:28.223