Script help

jmacavali

Fully Optimized
Messages
4,867
I'm looking for a script of some kind that I can run on a many laptops that will set the default function for when you close the lid. I want it to "do nothing". I want it also to set the function for all users.

I don't know if it exists or if it's possible but if anyone has any insight that would be great! Thanks!
 
Assuming these are all Win 7 laptops...

Code:
powercfg /SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e
powercfg /SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
powercfg /SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0

The first line is going to set the Power Scheme to the default "Balanced" scheme. Then it will modify the lid close action for both Plugged and unplugged to do nothing on lid close.

Put in notepad and save as "something.bat"
Execute on each laptop

EDIT: Re: All Users
Is this in a Microsoft domain environment?
 
Last edited:
Yes it's a domain. However, I run several other bat files as soon as I finish imaging computers anyway so it's not the end of the world to go ahead and run this one too. Works perfect. Thanks so much for your help! I looked all over the internet to try to find something.

Got one handy for XP by chance?
 
The difference between XP and the Windows Kernel of Vista and up is that with XP, you call the power scheme's and guid/sub_guids by alias. In the example above, Windows 7 requires that you gather the actual GUID first (using "powercfg /q | more") and then call them by the GUID value. With Windows XP, you can use the exact same syntax above, but substitute the GUID's for their Alias'.

Example:
Code:
powercfg /SETACTIVE SCHEME_BALANCED
powercfg /SETACVALUEINDEX SCHEME_BALANCED SUB_BUTTONS LIDACTION 0
powercfg /SETDCVALUEINDEX SCHEME_BALANCED SUB_BUTTONS LIDACTION 0

Will produce the same result
 
Last edited:
Once again, you are the man. I should have come here first, but I did learn enough in my searches to understand what you are saying, where before my hour of looking I would have had no clue what you were talking about. Thanks so much!
 
Ok, now here's a new one.

On XP I had a script that would remove the username from the registry so that when I froze the computers, it would have a blank username (and my username woud be removed). I'd like to do the same thing on Win7. Any thoughts?
 
Save as a .reg file

Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"DontDisplayLockedUserId"=dword:00000003
 
I notice it says "DontDisplayLockedUserId". Will this also remove the username if I resart the computer? That's how my XP one worked. I'm going to try it now and will let you know if it does what I need. Thanks so much for your help.
 
That did not work. It does not remove the username so that when the computer is restarted the username is blank. Any other ideas?
 
Back
Top Bottom