Solved

Help getting a power scheme logon script running!

Posted on 2008-10-27
8
834 Views
Last Modified: 2012-05-05
I have tried and tried to get a power scheme script to work.  I can't even seem to get a logon  script to run at all.  

this is a sample batch file that i have changed but to no avail:

@echo off
net use x: \\doman_DNS_name\netlogon

x:
powercfg.exe /change "always on" /monitor-timeout-ac 20
powercfg.exe /SETACTIVE "always on"
c:
net use x: /delete

I am relatively new at working with active directory but I believe I have a pretty good understanding of how it works.  I created OU with the group and users that I wanted the script to run on and linked the GPO to it.  Didn't work.  Also tried just using the Script path to no success either.  So I am not really sure if something is wrong with the batch file or if something is not set in AD to allow the script to run.  I am at a loss and need help.  Thank you in advance
0
Comment
Question by:geleman
  • 4
  • 3
8 Comments
 
LVL 31

Expert Comment

by:DrUltima
Comment Utility
First, I am not sure why you are mapping X: to your DC.  powercfg is builtin to Windows and in the path.  You can run it from C:\.  Next, you may want to turn the echo back on so you can see if there are any error messages.  I cannot see a fault in the two lines that actually invoke the changes you want.  How are you telling GP to run your script and how are you verifying that it is not running?
0
 
LVL 59

Expert Comment

by:Darius Ghassem
Comment Utility
0
 

Author Comment

by:geleman
Comment Utility
Dr. Ultima,
The X: from the place I got the sample from.  I have modified it a few different ways and it still didn't work.
As far verifying it running i set it up so it could be visible on the logon and I also did a report and it doesn't give a time it has ever run.  So I am not sure what I am doing wrong.  I have a few variations of the script that I ran if you would like to see those.  Other than that I tried it both was as far as running in via the Profile tab in the user file and the GPO.  This the link for which I found out how somebody did it via GPO.

http://lawrencepatterson.com/?p=3

I have actually found two other was to allow the user to adjust the power schemes one being how dariusq suggested and another is adding keys and granting permission on those keys in the default GPO.  I would just much rather figure out how to get it working through it's own GPO if possible.  Appreciate the quick responses.
0
 
LVL 31

Expert Comment

by:DrUltima
Comment Utility
One of the issues you may be facing is permissions.  To change the power settings in Windows XP, you need power user or admin access (or explicit change access to the referenced registry keys).  The page you referenced is for Windows XP, so that is what I assume you are running.  I am not sure your script will work if admin rights don't exist.
Honestly, dariusq's suggestion to use the Energy Star scheme is probably the easier solution.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:geleman
Comment Utility
I did go through and grant the permissions on the registry keys.  Pretty sure it was part of the article that I referenced.  I enabled full control in the edit of the GPO when I set it up.  The current solution I have set is enabling full control in the Domain Security Policy and it seems to work so I am pretty sure I have the permissions set right when I do the GPO.  I'm really thinking that it has something to do with the batch file that I am running but I am not sure.  I really want to try to not to have to install the enery star because it requires a client.  If I can't get the GPO to work right then I'll stick with the edit I did, but I'm hard headed and like to see things work.  Here is one variation of the batch that I used.

@echo off
net use  c: \\doman_DNS_name\netlogon

powercfg.exe /change "always on" /monitor-timeout-ac 20
powercfg.exe /SETACTIVE "always on"

net use c: /delete

and

@echo off
net use  \\doman_DNS_name\netlogon

powercfg.exe /change "always on" /monitor-timeout-ac 20
powercfg.exe /SETACTIVE "always on"

net use  /delete


The thing that really confuses me about the article is it says to put a copy of powercfg.exe to the netlogon.  Shouldn't it be able to reference the system root where it is originally located?
0
 

Author Comment

by:geleman
Comment Utility
Also I have ran the batch file:

cd\

powercfg /change "always on" /monitor-timeout-ac 20
powercfg /setactive "always on'

/delete

locally and it worked fine

0
 
LVL 31

Accepted Solution

by:
DrUltima earned 500 total points
Comment Utility
Something to consider.  It is a bad idea to program specific usernames into a GPO... Rather than using a specific name, choose "Authenticated Users" when adding those two registry key.  Also, remember that before you click OK twice, that Autenticated Users needs to have Full Control.  Default is Read Only.  
I think your batch file is OK as originally posted, I still think it is a permission issues within the registry.  After making this change, log off and back on twice to see if the changes were propogated correctly on your test machine.
0
 

Author Closing Comment

by:geleman
Comment Utility
The batch file never worked so I went with just add registry keys in the Default Domain GPO and edited them so that the users could have access to their power configurations.  I am not sure why the batch wouldn't work but this way works just fine the batch would just automatically set it for them, instead of setting it themselves.  Thanks for the help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

763 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

8 Experts available now in Live!

Get 1:1 Help Now