Windows

[windows] RDP session time out(PowerShell)

plastic2113 2023. 10. 30. 11:25
728x90
반응형

RDP session time out(PowerShell)

* GUI로 설정하기 : https://plastic2113.tistory.com/entry/Windows-RDP-session-time-outGUI

 

[Windows] RDP session time out(GUI)

[Win + R] > gpedit.msc : 로컬 그룹 정책 편집기 실행 [로컬 그룹 정책 편집기 > 컴퓨터 구성 > 관리 템플릿 > Windows 구성 요소 > 터미널 서비스 > 원격 데스크톱 세션 호스트 > 세션 시간 제한] 탭에 활성

plastic2113.tistory.com

반응형

1. PowerShell을 통해 registry값 설정

* 최대 접속시간은 임의로 5분 설정

New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\' -Name MaxConnectionTime -PropertyType DWORD -Value [최대 접속시간]

* 아래 예시는 5분으로 설정, 최대 접속시간은 아래의 값 중 원하는 값으로 설정

setting max connection time registry value by powershell
PowerShell로 최대 접속 시간 설정

최대 접속시간 Value
사용안함 0
1분 60000
5분 300000
10분 600000
15분 900000
30분 1800000
1시간 3600000
2시간 7200000
3시간 10800000
6시간 21600000
8시간 28800000
12시간 43200000
16시간 57600000
18시간 64800000
1일 86400000
2일 172800000
3일 259200000
4일 345600000
5일 432000000
728x90

2. 설정한 registry값 확인

Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\' -Name MaxConnectionTime

check max connection time registry value by powershell
PowerShell로 설정한 최대 접속 시간 확인

* 설정된 registry값은 재부팅 후 적용.

> HKLM(HKEY-LOCAL-MACHINE)의 모든 registry값은 시스템의 동작에 영항을 주기에 내용 변경 후 재시작을 해야 변경된 값이 적용.

3. RDP session time out

재부팅 후 접속해서 이전에 설정한 최대 접속시간이 지난 후에는 아래와 같은 경고창이 표시됨.

logon timer alert
세션시간 제한 경고창

위 경고창에서 나오는 2분후 세션이 만료 되며 PowerShell로 적용한 RDP 최대 접속시간 제한 설정이 적용됨을 확인.

4. 설정된 registry값 삭제

Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\' -Name MaxConnectionTime

remove max connection time registry value by powershell
PowerShell로 설정된 최대 접속 시간 삭제

728x90
반응형