Require a password when a computer wakes (on battery)
Demander un mot de passe lorsqu’un ordinateur sort de la veille (sur batterie)
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.
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Power\PowerSettings\0e796bdb-100d-47d6-a2d5-f7d2daa51f51- Value name
DCSettingIndex
| 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/DCPromptForPasswordOnResume_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 'DCSettingIndex' -Value 1 -Type DWordDisable
# Disable: Power/DCPromptForPasswordOnResume_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 'DCSettingIndex' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": Power/DCPromptForPasswordOnResume_2
$k = 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\0e796bdb-100d-47d6-a2d5-f7d2daa51f51'
Remove-ItemProperty -Path $k -Name 'DCSettingIndex' -ErrorAction SilentlyContinue