Solved

Remotely changing the function of the power buttons action from "Do Nothing" to "Shutdown" on multiple machines

Posted on 2008-10-24
12
800 Views
Last Modified: 2010-04-21
I am trying to find a way of changing the function of the power button from "Do nothing" to "Shutdown" on over 7000 screens running windows XP.

I have spent hours and hours on this - trawling the internet for information but have had little success.
Powercfg doesn't appear to have a switch to set this.

I have used a registry compare tool to and the following registry keys were changed:

[HKEY_CURRENT_USER\Control Panel\PowerCfg\GlobalPowerPolicy]
"Policies"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count]
"HRZR_EHAPCY"
"HRZR_EHAPCY:\"P:\\JVAQBJF\\flfgrz32\\cbjrepst.pcy\",Cbjre Bcgvbaf"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\BagMRU\0]
"MRUListEx"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags\1\Shell]
"ScrollPos800x480(1).y"=dword:00000000
"ShowCmd"=dword:00000001
"WFlags"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG]
"Seed"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Prefetcher]
"TracesProcessed"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Power]
"AcPolicy"
"DcPolicy"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power]
"AcPolicy"
"DcPolicy"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]
"@C:\\WINDOWS\\system32\\shell32.dll,-22924"

I exported all of these keys with the values correctly set and compiled the relevant keys into one file called SD Keys. I then set the test machine back to the "Do Nothing" setting and double clicked the SD Keys reg file and got the confirmation that the settings had been changed. However the setting within power options stayed at "Do Nothing" and pressing the power button had no effect.

Any help on this would be GREATLY appreciated.
0
Comment
Question by:deathbybatfile
  • 6
  • 6
12 Comments
 
LVL 51

Expert Comment

by:Netman66
ID: 22809220
It fairly simple when you use POWERCFG.exe.

You want to set your power options as you desire, then EXPORT them to a named file.
You can now save this file to a network share and execute POWERCFG /import to import that scheme into the local PC.

Running it remotely can be accomplished either using RDP or PSEXEC as long as the scheme is copied locally so you have access to it.



0
 

Author Comment

by:deathbybatfile
ID: 22811230
That does not accomplish the act of changing what the power button does when pressed. When you import the new scheme (and make it active) it doesn't include the power button setting.
0
 
LVL 51

Expert Comment

by:Netman66
ID: 22811239
Really?

Interesting.  It's supposed to be all part of that Power profile.

Let me see what I can find for you.
0
 

Author Comment

by:deathbybatfile
ID: 22811273
Yeah I did try it but it doesn't affect the power button - I've looked everywhere so any help you can offer will be well received!! Thanks.
0
 
LVL 51

Accepted Solution

by:
Netman66 earned 500 total points
ID: 22812132
Ok, I've managed to determine what gets changed using a program called RegShot.

Download it from here: http://downloads.sourceforge.net/regshot/regshot_1.8.2_src_bin.zip?modtime=1194107176&big_mirror=0

Open up the Power Options applet and configure everything the way you want it then Apply it.  Be sure to leave the Power Button setting to do nothing.  Leave the applet open and on the screen where the button change is made.

Run RegShot Shot1 with the defaults.
Leave it open when done.
Change the button setting and press Apply.
In RegShot run Shot2.
In RegShot run Compare.
Save the output log.

The only settings you likely need are in HKLM.  
Create a Reg file from this log and test it out.

It may need to be run as Admin, but let's get the basic steps working.
0
 

Author Comment

by:deathbybatfile
ID: 22813708
Thanks Netman - I'll try that. I did try the same thing with Reg snap but will try Reg shot and see if I have more luck.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 51

Expert Comment

by:Netman66
ID: 22814323
ok.

Those entries are a bit cryptic.  I'm really not sure about the Cryptographic keys and whether your domain workstations have all the same values.  You *might* get by without using those entries, you'll have to test what the bare minimum is in terms of what keys to modify to get this to work.

0
 

Author Comment

by:deathbybatfile
ID: 22833187
This tool gave me pretty much the same settings but when I exported each of the settings (in the desired state - to shutdown) - changed the machine to "Do nothing" then imported the relevant reg files it has no effect. Not sure why this won't work. Any ideas?
0
 
LVL 51

Expert Comment

by:Netman66
ID: 22834032
No, I can't imagine why - sorry.

0
 

Author Comment

by:deathbybatfile
ID: 22893620
This is a bit embarassing really and just indicative of my newcomer status to programming!

I've just been working on another bat file to change the settings of another program which involved changing the registry settings - again these were not reflected in the GUI on examination but after restart they were. I realised that this may well have been the issue with this earlier attempt to change the power button setting and sure enough on testing it - that's all it was. I guess each program needs re-initialising with it's new settings.

Thought I should update and close this question as I found very little data on this online though it is perhaps more obvious to a more experienced programmer.

For clarity - the keys I had to change (for Win XP) were:

HKEY_CURRENT_USER\Control Panel\PowerCfg\GlobalPowerPolicy]
"Policies"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Power]
"AcPolicy"
"DcPolicy"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power]
"AcPolicy"
"DcPolicy"

This set it exactly as I wanted it after restart. My only issue then was to make it run once only which was simply acheived by creating a dat file and skipping the import if this file existed.

Thanks for all the help :D
0
 

Author Closing Comment

by:deathbybatfile
ID: 31509574
Thanks - can't blame you for presuming I would have had the sense to restart the damn cpu after import! >.<
0
 
LVL 51

Expert Comment

by:Netman66
ID: 22894871
LOL....too funny.

You wouldn't expect a Reg setting to require a reboot, but I guess this is one that does...good to know!

Thanks,
NM
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hyper V vm 4 126
Tasks remote computer 12 148
Upgrade or retire 8 96
netsh interface ip show interface in Windows XP 4 118
Disclosure: Use this tutorial only when no other options helps to get Windows XP running without any problems and you don't want to format the drive. The back up of the data is the responsible of the user, however there is a description of how t…
We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now