Interactive logon: Smart card removal behavior: registry value ScRemoveOptionComputerHKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon

Category
Security Settings › Local Policies › Security Options
Scope
Computer Configuration
Source
Windows 11 (version 26H2 · 26300.9457)

Registry

ScRemoveOption

REG_SZComputer
Enabled value
Depends on the option value
Element
Interactive logon: Smart card removal behavior
Options
ItemStored value
No Action0
Lock Workstation1
Force Logoff2
Disconnect if a remote Remote Desktop Services session3
Disconnect if a remote Remote Desktop Services session, regardless of logon method4
Apply with .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]

; Options (use only one)
; No Action
"ScRemoveOption"="0"
; Lock Workstation
"ScRemoveOption"="1"
; Force Logoff
"ScRemoveOption"="2"
; Disconnect if a remote Remote Desktop Services session
"ScRemoveOption"="3"
; Disconnect if a remote Remote Desktop Services session, regardless of logon method
"ScRemoveOption"="4"
CMD
:: Options (use only one)

:: No Action
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "ScRemoveOption" /t REG_SZ /d 0 /f
:: Lock Workstation
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "ScRemoveOption" /t REG_SZ /d 1 /f
:: Force Logoff
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "ScRemoveOption" /t REG_SZ /d 2 /f
:: Disconnect if a remote Remote Desktop Services session
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "ScRemoveOption" /t REG_SZ /d 3 /f
:: Disconnect if a remote Remote Desktop Services session, regardless of logon method
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "ScRemoveOption" /t REG_SZ /d 4 /f
PowerShell
# Common: create the key
New-Item -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Force | Out-Null

# Options (use only one)
# No Action
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'ScRemoveOption' -PropertyType String -Value '0' -Force | Out-Null
# Lock Workstation
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'ScRemoveOption' -PropertyType String -Value '1' -Force | Out-Null
# Force Logoff
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'ScRemoveOption' -PropertyType String -Value '2' -Force | Out-Null
# Disconnect if a remote Remote Desktop Services session
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'ScRemoveOption' -PropertyType String -Value '3' -Force | Out-Null
# Disconnect if a remote Remote Desktop Services session, regardless of logon method
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'ScRemoveOption' -PropertyType String -Value '4' -Force | Out-Null