Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 824
  • Last Modified:

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

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
deathbybatfile
Asked:
deathbybatfile
  • 6
  • 6
1 Solution
 
Netman66Commented:
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
 
deathbybatfileAuthor Commented:
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
 
Netman66Commented:
Really?

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

Let me see what I can find for you.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
deathbybatfileAuthor Commented:
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
 
Netman66Commented:
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
 
deathbybatfileAuthor Commented:
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
 
Netman66Commented:
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
 
deathbybatfileAuthor Commented:
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
 
Netman66Commented:
No, I can't imagine why - sorry.

0
 
deathbybatfileAuthor Commented:
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
 
deathbybatfileAuthor Commented:
Thanks - can't blame you for presuming I would have had the sense to restart the damn cpu after import! >.<
0
 
Netman66Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now