We help IT Professionals succeed at work.

Disable Password When Resuming From Sleep

I need to be able to let a unit go to sleep when the notebook lid is closed, but not prompt for a password when it resumes.

I've looked this up and found that a lot of people recommend a registry key that doesn't exist in Windows 7/Vista and if I try adding it, it doesn't work.

I've looked into APIs, but I can't seem to find much information on it.

Any ideas?
Comment
Watch Question

Control Panel-> Power Options->Change Advanced Power Options

At/Near the top there should be "Require a password on wakeup"

Commented:
brendanmeyer,

I'm sorry, but that is terrible advice. I posted this in programming sections because I need to do this automatically, through my application.

Author

Commented:
Err... apparently I wrote that comment with an account I no longer use. The comment still stands though.
Hi Weirddemon,
Your question is not very clear.
Are you asking how to stop the password dialog from appearing when you open the laptop lid and awaken it from hibernation? If so, then Brenanmeyer's response is the one you want.
However,
if you are asking how to stop your application from calling a password dialog when it awakens from hibernation, then one option would be for your application to process the PBT_APMSUSPEND event, which is received through the WM_POWERBROADCAST message.
This message notifies applications that the computer is about to enter a suspended state.

You might want to check this page out as well:
http://msdn.microsoft.com/en-us/library/aa373235%28v=VS.85%29.aspx
sorry about that

under:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\User\PowerSchemes,
lists the 3 default power scheme and assuming any custom schemes; and has the following keys
381b4222-f694-41f0-9685-ff5bb260df2e - Balanced
8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c - High Performance - I am currently running this scheme.
a1841308-3541-4fab-bc81-f71556f20b4a - Power Saver

under these keys .. there are keys for the options you have changed in the power settings
for example
0e796bdb-100d-47d6-a2d5-f7d2daa51f51 - being require password on wakeup
In here you will see ACSettingIndex, and DCSettingIndex
 PowerSchemeChanges
for the values of the SettingIndex's
look under
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\PowerSettings
There you will see the key 0e796bdb-100d-47d6-a2d5-f7d2daa51f51
here you will see a key "0" and "1" - which will explain the option
 PowerSchemeChanges
therefore set the AC/DCSettingIndex to 0 to not require a password

Note1: This may be different on your system - but unlikely
Note2: To Change the value on my system, I needed to be running as the SYSTEM user. - A Service

I hope this helps
2.png
All,

I'm sorry if I wasn't very clear. I can do this manually without any issues. But what I really need is to be able to do this automatically.

I don't want a password to appear when the unit resumes from sleep mode and I need my application to be able to automatically disable that feature.

Before, I was just importing a custom power setting I had exported before. I didn't want to keep that route, because I thought there might be an easier way and less messy way, such as an API or simple registry setting.

I can't find an API and in the case of the registry, it appears that I'll need to know the GUID. Which I don't want to mess with. So I'll just stick to importing the power file via PowerCfg command line.

Thanks, guys.

Author

Commented:
I'm staying with my old method, but brendanmyer's example is viable.