en-US windows computer

Disconnect remote session on lock for legacy authentication

Verified with Windows 11 25H2 — updated on July 30, 2026

Windows 11 25H2

Supported on: At least Windows Vista

Path in the GPO console

Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Security

Description

This policy setting allows you to configure the user experience when the Remote Desktop session is locked by the user or by a policy. You can specify whether the remote session will show the remote lock screen or disconnect when the remote session is locked. Disconnecting the remote session ensures that a remote session cannot be left on the lock screen and cannot reconnect automatically due to loss of network connectivity. This policy applies only when using legacy authentication to authenticate to the remote PC. Legacy authentication is limited to username and password, or certificates like smartcards. Legacy authentication doesn't leverage the Microsoft identity platform, such as Microsoft Entra ID. Legacy authentication includes the NTLM, CredSSP, RDSTLS, TLS, and RDP basic authentication protocols. If you enable this policy setting, Remote Desktop connections using legacy authentication will disconnect the remote session when the remote session is locked. Users can reconnect when they're ready and re-enter their credentials when prompted. If you disable or do not configure this policy setting, Remote Desktop connections using legacy authentication will show the remote lock screen when the remote session is locked. Users can unlock the remote session using their username and password, or certificates.

Registry

HKLM SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services

Value name: fDisconnectOnLockLegacy

Enabled: fDisconnectOnLockLegacy = 1

Disabled: fDisconnectOnLockLegacy = 0

MDM / Intune (CSP)

./Device/Vendor/MSFT/Policy/Config/RemoteDesktopServices/DisconnectOnLockLegacyAuthn
Device Since [10.0.20348.2461] and later | [10.0.25398.887] and later | Windows 10, version 2004 [10.0.19041.4474] and later | Windows 11, version 21H2 with KB5037770 [10.0.22000.2960] and later | Windows 11, version 22H2 with KB5037771 [10.0.22621.3593] and later | Windows 11, version 24H2 [10.0.26100] and later Official mapping (Microsoft Learn)

Microsoft Learn documentation Mapping data: Microsoft Learn (CC BY 4.0)

Export Builder

BETA

Configure the state, scope and options, then generate .reg, PowerShell, Intune and SCCM outputs — or add the setting to a multi-setting collection.

These exports write the registry — this is not a managed GPO.

.reg file

Windows Registry Editor Version 5.00

; Exported from gporais.com
; Policy: Disconnect remote session on lock for legacy authentication
; State: Enabled
; Supported on: At least Windows Vista

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]
"fDisconnectOnLockLegacy"=dword:00000001
More formats (PowerShell, Intune, SCCM)

PowerShell

# Exported from gporais.com
# Policy: Disconnect remote session on lock for legacy authentication
# State: Enabled
# Supported on: At least Windows Vista

$path = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'fDisconnectOnLockLegacy' -Value 1 -Type DWord

Building a multi-setting collection? Add this setting and generate combined .reg / PowerShell / GPO scripts.

Open the Builder

Embed this policy on your site

What to embed
Theme

Adds one script line: the theme follows your site’s appearance and the height fits the content. If your site blocks scripts, the embed follows the visitor’s system theme.

Preview