Require a password when a computer wakes (plugged in)
Demander un mot de passe lorsqu’un ordinateur sort de la veille (sur secteur)
Explanation
This policy setting specifies whether or not the user is prompted for a password when the system resumes from sleep.
If you enable or do not configure this policy setting, the user is prompted for a password when the system resumes from sleep.
If you disable this policy setting, the user is not prompted for a password when the system resumes from sleep.
Ce paramètre de stratégie spécifie si l’utilisateur doit entrer un mot de passe lorsque le système sort de veille.
Si vous activez ou ne configurez pas ce paramètre de stratégie, l’utilisateur est invité à entrer un mot de passe lorsque le système sort de veille.
Si vous désactivez ce paramètre de stratégie, l’utilisateur n’est pas invité à entrer un mot de passe lorsque le système sort de veille.
Use cases
Requires a password when the computer wakes from sleep while plugged in: the system returns to the secure desktop instead of reopening the session. Enabled or not configured, the password is requested; disabled, the session resumes without any new authentication, which leaves a stolen or unattended machine exploitable.
Microsoft states that the behaviour is on by default on desktop editions of Windows; it was not always on in some editions of Windows 8.1 and earlier. The same logic exists for battery operation: configure both variants, so that a laptop does not unlock its screen on wake while on battery.
Microsoft source: Prompt for password on resume
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Power\PowerSettings\0e796bdb-100d-47d6-a2d5-f7d2daa51f51- Value name
ACSettingIndex
| State | Value written |
|---|---|
| Enabled | REG_DWORD = 1 |
| Disabled | REG_DWORD = 0 |
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: Power/ACPromptForPasswordOnResume_2
$k = 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\0e796bdb-100d-47d6-a2d5-f7d2daa51f51'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'ACSettingIndex' -Value 1 -Type DWordDisable
# Disable: Power/ACPromptForPasswordOnResume_2
$k = 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\0e796bdb-100d-47d6-a2d5-f7d2daa51f51'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'ACSettingIndex' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": Power/ACPromptForPasswordOnResume_2
$k = 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\0e796bdb-100d-47d6-a2d5-f7d2daa51f51'
Remove-ItemProperty -Path $k -Name 'ACSettingIndex' -ErrorAction SilentlyContinue