Re: Power Management GPO?
- From: "Jeremy" <jeremy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 2 Jun 2007 17:57:39 +1000
Well the 0 exit code is just what the batch file is returning, rather than the powercfg exit code. I'm not sure where to point you because when I set the batch file to run at system startup it worked well. What happens when you run the task manually from task scheduler (right-click, run now)?
"Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx> wrote in message news:OBh%23$LJpHHA.3772@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for the suggestions Jeremy. I followed your advice and setup a batch file using powercfg to set all the power settings the way I'd like them to be. Ran the batch file as Administrator and it worked fine. Next I created a scheduled task to run my batch file as "system" and to run at system start up. That worked as well.
So then I created a GPO that runs a computer startup script. The script checks for the existance of my batch file in the root of the target PC. If the batch file does not exist it creates it and then creates a task to run it at startup using the "system" account.
All of this works, however, when the computer starts the batch file isn't run... well, it looks like it's running but it does not set the power settings. When I look at the task scheduler log file it shows the following entries:
"Power Setup.job" (power.bat)
Started 6/1/2007 4:04:15 PM
"Power Setup.job" (power.bat)
Finished 6/1/2007 4:04:16 PM
Result: The task completed with an exit code of (0).
[ ***** Most recent entry is above this line ***** ]
I'm guessing the exit code of (0) is a good exit code as opposed to an error exit code. I'm not sure what's happening now. Any suggestions? Or should I post this question on a different news group?
Thanks much,
Linn
"Jeremy" <jeremy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:41FDEE4D-EE9C-4195-9E9A-9E2CE683AE85@xxxxxxxxxxxxxxxxI think I have a fix for this. I created a scheduled task that runs as SYSTEM and executes the .cmd file I created which has the following line in it:
powercfg /hibernate off
I turned hibernate on, then waited for the schedule and it worked, so SYSTEM does have the ability to change power settings. So I changed the schedule to "when the system starts", turned hibernate on and rebooted and it worked.
So, long story short, I am guessing you could create a startup script that creates the scheduled task (using schtaks.exe) to run a second script that sets the power configuration. Then it would take two reboots, but it would still work. A bit kludgy I suppose....
Anyhoo, good luck.
Cheers,
Jeremy.
"Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx> wrote in message news:u5UQgpxnHHA.4196@xxxxxxxxxxxxxxxxxxxxxxxI have been working this afternoon on a script for just this purpose. I have a power.bat file now that when run by the administrator sets the power the way I want it. Of course that only works for the adminstrator.
I created a GPO and put the batch file in first as a startup script and when that didn't work I tried it as a logon script. At first it didn't work, then I linked it to the domain administrator's OU and then it worked for that account. I tried liking it to the OU of my test user but that didn't work.
Next I added my test user to the administrator's group of the local computer, now it works. Looks to me like it's a rights issue at this point. A normal user can't change the power settings so a logon script like this won't work either. Or am I missing something here?
Thanks much,
Linn
Ok, now that I've linked my GPO to the administrators and services
"Jeremy" <jeremy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:5D7771AA-D92D-4A3D-9437-344807222726@xxxxxxxxxxxxxxxxWell using a flag file on the hard disk might be easier then. This way you can do it with a simple .cmd file.
Run powercfg from the command line with a /? and you will be able to build the commands you want the set up a .cmd file as follows:
-->8 snip here
@ECHO OFF
IF NOT EXIST %TEMP%\powerscript.flg (
powercfg command 1
powercfg command 2
powercfg command n
ECHO finished > %TEMP%\powerscript.flg
)
-->8 snip here
The first line turns of local echoing of commands to the screen to make the output cleaner.
The second line is the test to see if the flag file exists
The next three commands represent you doing your powercfg stuff
The next command writes the flag file so that next time the script runs, it wont meet the condition so will skip all the powercfg stuff
The close bracket closes off the IF condition. It is very important that it be on a line on its own in the script.
I can't remember if all power setting are per machine, but if some are per machine and some are per user then you could split it up into 2 scripts, one startup script and one logon script. The use of the %TEMP% environment variable would mean that if you ran it as a logon script that the powecfg commands would be run per user who logged onto the machine.
HTH
Cheers,
Jeremy,
"Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx> wrote in message news:%23T4KAswnHHA.3460@xxxxxxxxxxxxxxxxxxxxxxxYes, that's what I'm finding. I have everything setup, I can see by running gpresult on the client computer that the GPO's are being applied. They just aren't taking effect.
With EZ-GPO there is a small client executable that needs to be installed. I can't even get that to work. I can install it manually but not using a GPO, even though gpresult shows it as being applied. I don't know what the secret is to that.
I'm not familiar with POWERCFG but I'll look into it. I'm also not very experienced at writing scripts but I'll take a shot at it. An example would sure be helpful, especially the bit about the registry flag.
Thanks much,
Linn
"Jeremy" <jeremy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:A3D93BAF-3E24-44DB-B910-BCFBB6B0F1F1@xxxxxxxxxxxxxxxxPower management settings are evil. Like a few other settings it appears that the registry is just where they get stored. From my fiddling it appears that you can change the registry setting but the GUI setting doesn't change until next startup, or sometimes even ever. It appears that the power management API probably retrieves the configured values from here during system startup then stores them in memory or somewhere else because now matter how much manual modification I did, I could never get settings to stick, so here is my suggestion:
Use POWERCFG. If you simply want to set the settings once, write a script that makes the changes and the drops in a registry flag to indicate the state so that it doesn't keep running all the time. If you want to set the settings for different times of the day as suggested by another poster, then put in a scheduled task running as SYSTEM that changes the settings based on the time of day. Adding the scheduled task can also be scripted in a startup script using schtaks.exe.
Good luck.
Cheers,
Jeremy.
"Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx> wrote in message news:ejtsGPLnHHA.4516@xxxxxxxxxxxxxxxxxxxxxxxHi All,
I'm trying to figure out how to set the power settings of the computers in my organization. They are almost all Windows XP Pros, a couple Windows 2000 Pro but I'm not going to worry about them right now.
I know that Microsoft set this up so that a standard User does not have rights to change the power settings and so far I have not been able to find a way to set them globally.
I have been looking at EZ GPO from Terranovum but it only gets me part way there. There are a couple settings that it doesn't address. What do you folks do, how do you handle this... or don't you?
EZ GPO sets the time outs for the User monitor timeout, System standby timeout and Hibernation timeout, but what about the other settings? Hard Disk timeout, Prompt for password when computer resumes from standby, When I press the power button on my computer and Hibernate enable/disable? How can I go about setting those options?
Oh, this is an active domain network with Windows 2003 Server domain controllers.
Thanks in advance,
Linn
.
- Follow-Ups:
- Re: Power Management GPO?
- From: Linn Kubler
- Re: Power Management GPO?
- References:
- Re: Power Management GPO?
- From: Linn Kubler
- Re: Power Management GPO?
- Prev by Date: Re: Office 2007 adm templates
- Next by Date: Re: Deploying Office 2003 package... GPO applying, "software installation" policy not applying
- Previous by thread: Re: Power Management GPO?
- Next by thread: Re: Power Management GPO?
- Index(es):