Deny logoff of an administrator logged in to the console session
Refuser la déconnexion d'un administrateur connecté à la session de la console
Explanation
This policy setting determines whether an administrator attempting to connect remotely to the console of a server can log off an administrator currently logged on to the console.
This policy is useful when the currently connected administrator does not want to be logged off by another administrator. If the connected administrator is logged off, any data not previously saved is lost.
If you enable this policy setting, logging off the connected administrator is not allowed.
If you disable or do not configure this policy setting, logging off the connected administrator is allowed.
Note: The console session is also known as Session 0. Console access can be obtained by using the /console switch from Remote Desktop Connection in the computer field name or from the command line.
Ce paramètre de stratégie détermine si un administrateur tentant de se connecter à distance à la console d'un serveur peut déconnecter un administrateur actuellement connecté à la console.
Cette stratégie est utile quand l'administrateur actuellement connecté ne veut pas être déconnecté par un autre administrateur. Si l'administrateur connecté est déconnecté, les données n'ayant pas été enregistrées auparavant sont perdues.
Si vous activez ce paramètre de stratégie, la déconnexion de l'administrateur connecté n'est pas autorisée.
Si vous désactivez ce paramètre de stratégie ou si vous ne le configurez pas, la déconnexion de l'administrateur connecté est autorisée.
Remarque : la session de la console est également appelée Session 0. L'accès à la console peut être obtenu en utilisant le commutateur /console dans le champ du nom d'ordinateur de Connexion Bureau à distance ou à partir de la ligne de commande.
Registry
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services- Value name
fDisableForcibleLogoff
| 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: TerminalServer/TS_FORCIBLE_LOGOFF
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'fDisableForcibleLogoff' -Value 1 -Type DWordDisable
# Disable: TerminalServer/TS_FORCIBLE_LOGOFF
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'fDisableForcibleLogoff' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": TerminalServer/TS_FORCIBLE_LOGOFF
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
Remove-ItemProperty -Path $k -Name 'fDisableForcibleLogoff' -ErrorAction SilentlyContinue