2

I want to use the power button to turn off my Windows 7 machine without having to login or unlock it. I want to do this on my machine, plus we will likely want to do it on some student lab machines. On my machine it's a pain because I have an faux "air gap" separating my main machine from this one because I do computer security work, and right now I don't even have a KVM yet so I have to swap mice and keyboards and press several buttons on the monitor and enter my password just so I can turn the thing off.

I of course Google'd this and searched SU extensively; the only close question I can find how to make KDE do this. Microsoft allows me to disable screensaver password protection entirely easily enough via the Power Options dialog or other ways, but I don't want to give some random person access to my account, I just want the machine to power off without having to pull the plug and possibly corrupt the drive. Basically I want "psshutdown" to run when I press the power button. I also checked the Windows policy editor but couldn't find anything easily.

I think Windows XP did this, although I can't recall for sure. I realize that some of my applications might be very unhappy about being told to go away whether they like it or not, but I don't really care. I suppose if Windows refused to complete shutdown if the applications refused to quit that would be ok.

2 Answers 2

4

The power button settings are, in both XP and 7, under "Power Options" (powercfg.cpl).

Power settings Power button settings

Also check the security policy (secpol.msc) – you may need to add Everyone and Anonymous under Local Policies - User Rights - Shut down the system, but this probably won't affect the power button (just the lock screen).


If the disk is not being actively used (written to), pulling the plug isn't that bad. From my experience, if any inconsistencies do appear, NTFS fixes them automatically.

3
  • 2
    Ouch! pulling the plug, nasty way to shut down, you better hope there is not an open handle when you do this. Yes I have done it many times without issues, but making it a common practice is ill advised.
    – Moab
    Aug 4, 2011 at 16:26
  • Excellent, thank you so much! All, note this may not work until after a reboot as in my case.
    – Paul
    Aug 9, 2011 at 21:22
  • 1
    Also, I would not advise pulling the power plug in most situations. Worries include quality of NTFS journal recovery, whether the sparking is hard on the power supply, and whether desktop hard drives really always autopark properly on unwarned powerfail.
    – Paul
    Aug 9, 2011 at 21:23
0

It is unclear from your question whether you can or cannot reach the power button.

All modern systems have a soft power button that does not cut the power immediately if it is pressed momentarily. That button can be optioned within Windows to initiate standby, hibernate (if enabled), or a regular OS shutdown and power off. The effect of the latter is exactly like going through the "shutdown" dialog in the OS GUI.

However, holding that power button for 4 seconds will cause an immediate power off, with no OS shutdown notification. In terms of the effect on the OS, it is similar to pulling the plug. Unlike pulling the plug, though, the power supply will continue to emit +5 standby power.

If you cannot reach your power button, cutting the power to the system by removing the cord or flipping the switch on the power bar will work, but it's not the best thing for the hardware, or for the operating system, or for running applications. There is often no harm at all... but this can't be guaranteed.

The other thing to do is put a script on both your machines calling psshutdown for the other machine, or for all the machines in the lab.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .