คู่มือแก้ปัญหา Remote Desktop (RDP) สำหรับทีม IT Helpdesk: CredSSP, NLA, Black Screen และ Error Codes บน Windows 11 25H2

คู่มือแก้ปัญหา Remote Desktop (RDP) บน Windows 11 25H2 สำหรับทีม IT Helpdesk ครอบคลุม CredSSP, NLA, Black Screen, Error 0x204, RD Gateway, RD Licensing พร้อม PowerShell Playbook ที่นำไปใช้ diagnose ได้จริง

แก้ปัญหา RDP Windows 11 25H2 (2026)

อัปเดตล่าสุด: 27 กรกฎาคม 2026

Remote Desktop (RDP) คือโปรโตคอลของ Microsoft ที่ใช้เชื่อมต่อไปยังเครื่อง Windows อีกเครื่องหนึ่งผ่านเครือข่าย โดยใช้พอร์ต TCP/UDP 3389 เป็นค่าเริ่มต้น ปัญหาที่ทีม IT Helpdesk เจอบ่อยที่สุดในปี 2026 บน Windows 11 25H2 คือ CredSSP encryption oracle mismatch, Network Level Authentication (NLA) ล้มเหลว, Black Screen หลัง login สำเร็จ และ Error 0x204 / "This computer can't connect to the remote computer" ในคู่มือนี้ฉันจะพาไล่ตั้งแต่การตรวจสอบพื้นฐานว่า RDP เปิดใช้งานหรือไม่ ไปจนถึง PowerShell playbook ที่นำไปใช้ diagnose ได้จริง

  • RDP บน Windows 11 25H2 ใช้พอร์ต TCP 3389 (และ UDP 3389 สำหรับ RemoteFX/UDP transport) ต้องเปิดทั้ง Firewall Rule "Remote Desktop - User Mode (TCP-In)" และ "(UDP-In)"
  • CredSSP encryption oracle mismatch (Error 0x80090327 / 0x8009030C) แก้ที่ฝั่งที่ patch เก่ากว่า อย่าลด AllowEncryptionOracle ไปที่ 2 (Vulnerable) เด็ดขาด
  • NLA (Network Level Authentication) เป็นค่า default ตั้งแต่ Windows 8 บังคับให้ authenticate ก่อนสร้าง session: ปิด NLA เป็นทางแก้ชั่วคราวเท่านั้น ไม่ใช่ทางแก้ถาวร
  • Black Screen หลัง login ส่วนใหญ่มาจาก UDP transport, ไดรเวอร์ Display Adapter (Nvidia/AMD) หรือ Registry value fEnableUsage บน RDP
  • Error 0x204 มักเกิดจาก firewall/route/DNS ไม่ใช่ authentication: ทดสอบด้วย Test-NetConnection -Port 3389 ก่อนเสมอ
  • RD Gateway และ RD Licensing ต้องมี CAL (Client Access License) และ certificate ที่ trusted: grace period 120 วันหลังติดตั้ง RDS Role

Remote Desktop คืออะไร และปัญหาที่พบบ่อยบน Windows 11 25H2

Remote Desktop Protocol (RDP) เวอร์ชันที่ใช้บน Windows 11 25H2 คือ RDP 10.x ซึ่งรองรับ Multi-monitor, RemoteFX Adaptive Graphics, UDP transport (สำหรับ WAN ที่มี latency สูง) และ Windows Hello for Business แบบ passwordless แต่ในเวิร์กโหลด Helpdesk ปกติ เราจะเจอปัญหาเดิม ๆ ซ้ำ ๆ กัน 5 กลุ่มหลัก:

  1. Authentication failures: CredSSP mismatch, NLA ปิดไม่ตรง, password expired, account locked out (ดู คู่มือแก้ปัญหา Active Directory สำหรับ Account Lockout policy)
  2. Connectivity failures: Firewall block 3389, DNS ไม่ resolve, VPN drop, route missing (ดู คู่มือแก้ปัญหาเครือข่ายและ Wi-Fi)
  3. Session hang / Black Screen: mstsc.exe เชื่อมต่อสำเร็จ แต่หน้าจอเป็นสีดำ หรือ freeze หลัง credential prompt
  4. Redirection issues: Printer, Clipboard, Drive, USB, Audio ไม่ผ่านจาก client ไปยัง remote host
  5. RDS Farm issues: RD Gateway 401/403, RD Licensing "grace period expired", Connection Broker load balancing ผิดเครื่อง

ในทีมของฉัน ประมาณ 60% ของ ticket RDP ที่เข้ามาในไตรมาสที่ผ่านมาเป็นกลุ่มที่ 1 และ 2 (auth + connectivity) ส่วนอีก 40% กระจายกันระหว่างกลุ่มที่ 3–5 การมี playbook ที่แยกแยะกลุ่มปัญหาได้เร็วจะช่วยลด mean time to resolution (MTTR) ได้เยอะมาก

วิธีตรวจสอบว่า Remote Desktop เปิดใช้งานอยู่หรือไม่

ก่อนจะไล่ debug อะไรที่ซับซ้อน ต้องยืนยันก่อนว่า Remote Desktop เปิดใช้งานอยู่จริงบนเครื่องปลายทาง ซึ่งประกอบด้วย 3 ชั้น: Registry key, Service (TermService) และ Firewall Rule ทั้งหมดต้องเปิดครบทั้ง 3 อย่าง

ตรวจสอบผ่าน PowerShell (แนะนำสำหรับ Helpdesk)

# รันบน remote host เพื่อตรวจ 3 ชั้นในคำสั่งเดียว
# 1) Registry: fDenyTSConnections ต้องเป็น 0
Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' `
    -Name 'fDenyTSConnections' | Select-Object fDenyTSConnections

# 2) Service: TermService (Remote Desktop Services) ต้อง Running
Get-Service -Name TermService | Select-Object Status, StartType

# 3) Firewall: กฎ Remote Desktop ต้อง Enabled=True
Get-NetFirewallRule -DisplayGroup 'Remote Desktop' |
    Select-Object DisplayName, Enabled, Profile, Direction

ผลลัพธ์ที่คาดหวัง: fDenyTSConnections = 0, Status = Running, และ Firewall Rule ทั้ง 3 กฎ (TCP-In, UDP-In, ShadowSession-In) มี Enabled=True บน Profile ที่ตรงกับเครือข่ายที่ client ใช้เชื่อมต่อ (Domain / Private / Public)

เปิด RDP ด้วย PowerShell แบบ one-shot

# รันด้วยสิทธิ์ Administrator บนเครื่องปลายทาง
# เปิด Registry, Start service, และเปิด Firewall rule ในสคริปต์เดียว
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' `
    -Name 'fDenyTSConnections' -Value 0

Set-Service -Name TermService -StartupType Automatic
Start-Service -Name TermService

Enable-NetFirewallRule -DisplayGroup 'Remote Desktop'

# ตรวจสอบว่า port 3389 listening
Get-NetTCPConnection -LocalPort 3389 -State Listen

ถ้า Get-NetTCPConnection ไม่แสดง entry แสดงว่า TermService ไม่ได้ bind port: ให้เช็ค Event Log Application, System และ Microsoft-Windows-TerminalServices-LocalSessionManager/Operational เพื่อหา error ที่เจาะจง

แก้ปัญหา CredSSP encryption oracle (0x80090327 / 0x8009030C)

CredSSP encryption oracle mismatch เป็น error ที่ Microsoft patch มาตั้งแต่ CVE-2018-0886 แต่ยังเจอในองค์กรที่มี Windows Server เก่า (2012 R2, 2016 ที่ไม่ได้ patch) หรือมี Windows 11 client ที่ patch level ไม่ตรงกัน error message จะเป็น "An authentication error has occurred. The function requested is not supported" หรือ "The remote computer that you are trying to connect to requires Network Level Authentication (NLA), but your Windows domain controller cannot be contacted to perform NLA"

วิธีแก้ที่ถูกต้อง (patch ฝั่งที่เก่ากว่า)

  1. ตรวจ patch level ของทั้ง client และ server ด้วย Get-HotFix หรือ wmic qfe list
  2. ติดตั้ง Windows Update ล่าสุดบนฝั่งที่เก่ากว่า: สำหรับ Windows 11 25H2 คือ cumulative update ล่าสุด
  3. Reboot ทั้งสองฝั่งหลัง patch เสร็จ
  4. ทดสอบ RDP ใหม่

วิธีแก้ชั่วคราว (ใช้เมื่อจำเป็นเท่านั้น)

# ⚠️ ทางแก้ชั่วคราวเท่านั้น: ควร patch แล้วกลับไปตั้ง Force Updated Clients (0)
# บน client ที่เพิ่ง update แต่ต้องต่อไป server ที่ยังไม่ patch
# ตั้ง AllowEncryptionOracle = 1 (Mitigated) ไม่ใช่ 2 (Vulnerable!)

New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters' `
    -Force | Out-Null

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters' `
    -Name 'AllowEncryptionOracle' -Value 1 -Type DWord

# ค่า:
#   0 = Force Updated Clients (แนะนำ ปลอดภัยที่สุด)
#   1 = Mitigated (ยอมรับ client ที่ patch แล้ว, แต่ยอมต่อ server ที่ยังไม่ patch)
#   2 = Vulnerable (อย่าใช้เด็ดขาด: อนุญาตให้ MITM attack ได้)

Microsoft แนะนำใน CredSSP updates for CVE-2018-0886 ให้ patch ทุกเครื่องแล้วตั้ง AllowEncryptionOracle กลับไปที่ 0 หรือลบ key ทิ้ง เพื่อกลับสู่ default behavior ที่ปลอดภัย ห้ามใช้ค่า 2 บน production เด็ดขาด

แก้ปัญหา Network Level Authentication (NLA) ล้มเหลว

Network Level Authentication (NLA) บังคับให้ client authenticate ก่อนที่จะสร้าง remote session ทำให้ประหยัด resource บน host และป้องกัน DoS attack แต่จะมีปัญหาเมื่อ client ไม่สามารถติดต่อ Domain Controller ได้ (เช่น เครื่องอยู่นอกเน็ตเวิร์กและไม่ได้ต่อ VPN) หรือ credential cache หมดอายุ

อาการที่พบ

  • "The remote computer requires Network Level Authentication, which your computer does not support"
  • "An authentication error has occurred. The Local Security Authority cannot be contacted"
  • User พึ่งเปลี่ยนรหัสผ่าน แล้ว RDP ไม่รับ password ใหม่ทันที (SCRIL / Kerberos ticket cache)

ตรวจสอบสถานะ NLA

# เช็คว่า NLA เปิดอยู่บน host หรือไม่ (1 = เปิด, 0 = ปิด)
(Get-WmiObject -Class 'Win32_TSGeneralSetting' `
    -Namespace 'root\cimv2\terminalservices' `
    -Filter "TerminalName='RDP-tcp'").UserAuthenticationRequired

# ตรวจ SecurityLayer:
#   0 = RDP (native, weakest)
#   1 = Negotiate (default fallback)
#   2 = SSL / TLS (แนะนำ)
(Get-WmiObject -Class 'Win32_TSGeneralSetting' `
    -Namespace 'root\cimv2\terminalservices' `
    -Filter "TerminalName='RDP-tcp'").SecurityLayer

ปิด NLA ชั่วคราว (อย่าใช้ถาวร)

# ต้องรันบนเครื่อง host ด้วยสิทธิ์ Administrator
(Get-WmiObject -Class 'Win32_TSGeneralSetting' `
    -Namespace 'root\cimv2\terminalservices' `
    -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) | Out-Null

# หลังแก้ปัญหาแล้วต้องกลับมาเปิด NLA เพื่อความปลอดภัย
# (Get-WmiObject ...).SetUserAuthenticationRequired(1) | Out-Null

ถ้า NLA เปิดอยู่แต่ user ต่อไม่ได้ ให้เช็ค Kerberos ticket ด้วย klist และล้าง cache ด้วย klist purge จากนั้น log off / log on ใหม่ อีกจุดที่มักเจอคือ Group Policy "Require use of specific security layer for remote (RDP) connections" ถูกบังคับให้เป็น SSL แต่ certificate ของ host expired: ต้อง renew self-signed cert ที่เก็บใน Personal store ของ NT AUTHORITY\NETWORK SERVICE

Black Screen หลัง login RDP: สาเหตุและวิธีแก้

Black screen หลัง login สำเร็จ (mstsc แสดงหน้าจอสีดำ ไม่มี taskbar) เป็น bug ที่กลับมา ๆ ตลอดหลาย build ใน Windows 11 25H2 สาเหตุหลัก 3 อย่างคือ UDP transport มีปัญหากับ latency สูง, ไดรเวอร์ Display Adapter บน host, หรือ Registry value ที่ควบคุมการ enum session

วิธีแก้ที่ได้ผลตามลำดับ

  1. กด Ctrl+Alt+End แล้วเลือก Task Manager: ถ้า Task Manager โผล่มา แสดงว่า session ยังทำงานอยู่ แค่ Explorer.exe ไม่ start ให้รัน explorer.exe จาก File → Run new task
  2. ปิด UDP transport บน client ผ่าน Group Policy หรือ Registry:
# บน client (ไม่ใช่ host)
# Computer Config > Admin Templates > Windows Components > Remote Desktop Services
#   > Remote Desktop Connection Client > Turn Off UDP On Client > Enabled

# หรือใช้ Registry โดยตรง:
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\Client' `
    -Force | Out-Null
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\Client' `
    -Name 'fClientDisableUDP' -Value 1 -Type DWord
  1. อัปเดตไดรเวอร์ Display Adapter บน host: Nvidia RTX/Quadro และ AMD driver บางเวอร์ชันมีปัญหา conflict กับ Indirect Display Driver ของ RDP ใช้ pnputil /enum-drivers เพื่อเช็ค driver signing และ version
  2. รีเซ็ต RDP Cache ที่ client:
# ลบ .bmc cache ทิ้ง (bitmap cache ที่เสียหายทำให้ black screen)
Remove-Item "$env:LOCALAPPDATA\Microsoft\Terminal Server Client\Cache\*" -Force -Recurse
Remove-Item "$env:USERPROFILE\Documents\Default.rdp" -Force -ErrorAction SilentlyContinue

ถ้ายังเจอ black screen หลังทำครบทุกข้อ ให้เก็บ Event Log จาก Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational ส่งไปพร้อม ticket: Event ID 1149 (Remote Desktop Services: User authentication succeeded) จะบอกเวลา login สำเร็จ ส่วน Event ID 1024/1025 บอกปัญหา session ที่ตามมา

Error 0x204 และ "The computer can't connect to the remote computer"

Error 0x204 (หรือ error code 0x000000204) แปลตรงตัวว่า RDP client ไม่สามารถสร้าง TCP connection ไปยัง remote host ได้: ไม่ใช่ authentication problem แต่เป็น network path problem หลาย Helpdesk มักเสียเวลาไปเช็ค password ก่อนทั้งที่ควรเช็ค connectivity ก่อน

Diagnostic Sequence (Layer 3 → Layer 7)

# รันบน client ที่ต่อไม่ได้ แทน <HOST> ด้วย FQDN หรือ IP ของ remote

# 1) DNS resolve ก่อน: ถ้าล้มเหลว = ปัญหา DNS ไม่ใช่ RDP
Resolve-DnsName <HOST> -Type A

# 2) ICMP (อาจโดน firewall block ได้ แต่ยังมีประโยชน์)
Test-Connection -ComputerName <HOST> -Count 4

# 3) TCP port 3389: สำคัญที่สุด
Test-NetConnection -ComputerName <HOST> -Port 3389 -InformationLevel Detailed

# 4) ทดสอบทั้ง TCP และ UDP (Windows 11 25H2 มี Get-NetUDPEndpoint)
# ถ้า TcpTestSucceeded = False แต่ Ping ผ่าน = firewall block 3389

Root Cause ที่พบบ่อย

  • Firewall block ที่ host, network firewall, หรือ Windows Defender Firewall profile ไม่ตรง (เครื่อง classify เป็น Public แทน Domain)
  • Wrong DNS record: DNS ชี้ไป IP เก่าของเครื่องที่ decommission แล้ว
  • RDP-Tcp listener หาย: service TermService รันอยู่แต่ไม่ bind port ให้รัน netsh interface tcp show global และ Restart-Service TermService
  • Third-party VPN split-tunnel: route ไป private subnet ไม่ผ่าน tunnel (ดู คู่มือแก้ไขปัญหา VPN)
  • Port 3389 ถูกเปลี่ยน: บาง org เปลี่ยน RDP port ในไปที่อื่น (Registry key PortNumber ใน HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp) client ต้องระบุ port ต่อท้าย hostname เช่น server01:33389

RD Gateway และ RD Licensing สำหรับ RDS Farm

ในองค์กรที่ deploy Remote Desktop Services (RDS) แบบเต็ม จะมี component เพิ่มเติมคือ RD Gateway (สำหรับ external access ผ่าน HTTPS 443), RD Connection Broker (load balancing), RD Session Host (compute) และ RD Licensing (จัดการ Per-User / Per-Device CAL) ปัญหาที่เจอบ่อยที่สุดในทีมนี้คือ CAL expired และ Gateway certificate mismatch

RD Licensing: Grace Period และ CAL Assignment

เมื่อติดตั้ง RD Session Host แล้ว จะมี grace period 120 วันก่อนต้องมี RD Licensing Server ที่ activate แล้วและมี CAL เพียงพอ หลัง grace period หมด user จะต่อไม่ได้ทันที error message คือ "The remote session was disconnected because there are no Remote Desktop License Servers available"

# ตรวจ grace period ที่เหลือบน RD Session Host
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod' `
    -ErrorAction SilentlyContinue

# ตรวจว่า Session Host ชี้ไป License Server ตัวไหน
$rdsh = Get-WmiObject -Namespace 'root\cimv2\terminalservices' `
    -Class 'Win32_TerminalServiceSetting'
$rdsh.GetSpecifiedLicenseServerList()

# ตรวจว่า licensing mode ตั้งไว้ถูก (2 = Per Device, 4 = Per User)
$rdsh.LicensingType

ถ้า grace period หายจาก registry แสดงว่าติด CAL แล้ว ให้ไปเช็คที่ RD Licensing Manager บน License Server ว่า Per-User CAL Usage มีตรงกับจำนวน user จริง อ่านรายละเอียดเพิ่มเติมได้ที่ Remote Desktop Services client access licenses (RDS CALs) ของ Microsoft Learn

RD Gateway: 401/403 และ Certificate Issues

RD Gateway ใช้ HTTPS 443 เป็น transport เมื่อ user รายงาน "Your computer can't connect to the remote computer because the Remote Desktop Gateway server is temporarily unavailable" ให้เช็ค 3 จุดตามลำดับ:

  1. Certificate: Subject/SAN ตรงกับ FQDN ที่ user ใช้เชื่อมต่อ, ยังไม่ expired, chain trusted (ใช้ Enterprise CA หรือ public CA เช่น Sectigo/DigiCert)
  2. Connection Authorization Policy (CAP): user group ที่ถูกอนุญาต, device redirection ที่เปิด/ปิด
  3. Resource Authorization Policy (RAP): computer group / RD Session Host farm ที่ user มีสิทธิ์เข้าถึง, port 3389 ถูก allow
# ตรวจ RD Gateway operational log
Get-WinEvent -LogName 'Microsoft-Windows-TerminalServices-Gateway/Operational' `
    -MaxEvents 50 |
    Where-Object { $_.LevelDisplayName -in 'Error','Warning' } |
    Format-Table TimeCreated, Id, Message -AutoSize

Printer, Clipboard และ Drive Redirection ไม่ทำงาน

Redirection เป็นฟีเจอร์ที่ผูก resource ฝั่ง client (printer, clipboard, drive, USB, smart card, audio) เข้าไปใน remote session เมื่อ user บ่นว่า "copy paste ไม่ได้" หรือ "printer หายไป" ปัญหามักอยู่ที่ Group Policy บน RDS host, ไดรเวอร์ Easy Print, หรือ rdpclip.exe crash

ตรวจสถานะ Redirection บน host

# รันบน RDS Session Host: ค่า 1 = ปิด redirection (block), 0 = อนุญาต
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' `
    -ErrorAction SilentlyContinue |
    Select-Object fDisableClip, fDisableCdm, fDisableLPT, fDisablePNPRedir, `
                  fDisableCcm, fDisableCam

แก้ Clipboard ไม่ทำงาน (rdpclip crash)

# ใน session ที่มีปัญหา: kill rdpclip.exe แล้ว launch ใหม่
Stop-Process -Name rdpclip -Force -ErrorAction SilentlyContinue
Start-Process rdpclip.exe

# ถ้ายังไม่ได้ ลอง restart Terminal Services service (จะ disconnect session ทั้งหมด!)
# Restart-Service -Name TermService -Force

Printer Redirection: Easy Print vs Native Driver

Easy Print (Terminal Services Easy Print) ใช้ .NET Framework XPS driver ทำให้ไม่ต้อง install native driver บน RDS host: เหมาะกับ printer หลากหลายรุ่น แต่จะเจอปัญหา performance กับ printer ที่ต้องใช้ vendor driver (Zebra label, Dymo, receipt printer POS) วิธีแก้คือติดตั้ง native driver บน RDS host แล้ว disable Easy Print ผ่าน GPO "Use Remote Desktop Easy Print printer driver first" = Disabled

PowerShell Playbook สำหรับ Diagnose RDP

ต่อไปนี้เป็น diagnostic script ที่ทีมของฉันใช้จริง เป็น one-shot script ที่รวบรวมข้อมูลทั้ง host และ network ในไฟล์เดียว แนบไป ticket เพื่อให้ tier 2/3 ต่อได้ทันที ไม่ต้อง remote ไปเก็บซ้ำ

# rdp-diagnose.ps1: รันด้วยสิทธิ์ Administrator บนเครื่องที่มีปัญหา
# Output: C:\Temp\rdp-diag-<computername>-<timestamp>.txt

$outFile = "C:\Temp\rdp-diag-$env:COMPUTERNAME-$(Get-Date -Format 'yyyyMMdd-HHmmss').txt"
New-Item -ItemType Directory -Path 'C:\Temp' -Force | Out-Null

function Section($name) {
    "`n=== $name ===" | Out-File -FilePath $outFile -Append
}

Section 'System Info'
Get-ComputerInfo -Property WindowsProductName, WindowsVersion, OsBuildNumber, `
    CsDomain, CsUserName | Out-File -FilePath $outFile -Append

Section 'RDP Registry'
Get-ItemProperty 'HKLM:\System\CurrentControlSet\Control\Terminal Server' |
    Select-Object fDenyTSConnections, TSUserEnabled |
    Out-File -FilePath $outFile -Append

Section 'TermService Status'
Get-Service TermService, UmRdpService, SessionEnv |
    Format-Table -AutoSize | Out-File -FilePath $outFile -Append

Section 'Firewall Rules'
Get-NetFirewallRule -DisplayGroup 'Remote Desktop' |
    Select-Object DisplayName, Enabled, Profile, Direction, Action |
    Format-Table -AutoSize | Out-File -FilePath $outFile -Append

Section 'TCP Listeners on 3389'
Get-NetTCPConnection -LocalPort 3389 -ErrorAction SilentlyContinue |
    Format-Table -AutoSize | Out-File -FilePath $outFile -Append

Section 'NLA / SecurityLayer'
$tsg = Get-WmiObject -Namespace 'root\cimv2\terminalservices' `
    -Class Win32_TSGeneralSetting -Filter "TerminalName='RDP-tcp'"
"UserAuthenticationRequired (NLA): $($tsg.UserAuthenticationRequired)" |
    Out-File -FilePath $outFile -Append
"SecurityLayer: $($tsg.SecurityLayer)" | Out-File -FilePath $outFile -Append

Section 'CredSSP Registry'
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters' `
    -ErrorAction SilentlyContinue | Out-File -FilePath $outFile -Append

Section 'Recent RDP Events (last 24h)'
Get-WinEvent -FilterHashtable @{
    LogName   = 'Microsoft-Windows-TerminalServices-LocalSessionManager/Operational'
    StartTime = (Get-Date).AddDays(-1)
} -MaxEvents 50 -ErrorAction SilentlyContinue |
    Select-Object TimeCreated, Id, Message |
    Format-List | Out-File -FilePath $outFile -Append

Section 'Recent CredSSP Events'
Get-WinEvent -FilterHashtable @{ LogName='System'; ProviderName='LSA (LsaSrv)' } `
    -MaxEvents 20 -ErrorAction SilentlyContinue |
    Select-Object TimeCreated, Id, Message |
    Format-List | Out-File -FilePath $outFile -Append

"`nDiag written to: $outFile"
Write-Host "Diag written to: $outFile" -ForegroundColor Green

ในทีมของเรา script นี้ช่วยลด back-and-forth ระหว่าง tier 1 กับ tier 2 ได้ประมาณ 40% เพราะ tier 2 มีข้อมูลครบตั้งแต่ ticket แรก ไม่ต้อง remote เข้าเครื่อง user เพื่อไปเก็บ Event Log เอง

สำหรับ automated monitoring ระดับ enterprise แนะนำให้ ingest Event ID 1149 (Successful logon), 1150 (Session reconnect) และ 40 (Session logoff) จาก log Microsoft-Windows-TerminalServices-LocalSessionManager/Operational เข้า SIEM เพื่อ detect brute force pattern อ่านเพิ่มที่ General RDP connection troubleshooting ของ Microsoft

คำถามที่พบบ่อย (FAQ)

Windows 11 Home ใช้ RDP host ได้ไหม?

ไม่ได้ Windows 11 Home สามารถเป็น RDP client (ต่อออกไป) เท่านั้น ต้องเป็น Windows 11 Pro, Enterprise หรือ Education ขึ้นไปถึงจะเปิด Remote Desktop รับ inbound ได้ ถ้าจำเป็นต้อง remote เข้าเครื่อง Home ให้ใช้ tool อื่น เช่น Quick Assist, TeamViewer หรือ AnyDesk

RDP port 3389 เปลี่ยนได้ไหม และควรเปลี่ยนหรือไม่?

เปลี่ยนได้ผ่าน Registry key HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber แต่การเปลี่ยน port ("security by obscurity") ไม่ใช่ security control ที่แท้จริง: attacker สแกน port ทั้งหมดได้ในไม่กี่วินาที ทางที่ปลอดภัยกว่าคือใช้ RD Gateway, VPN หรือ Azure Bastion และเปิด Account Lockout Threshold บน AD

ทำไม RDP ต่อไป Windows Server ไม่ได้ ทั้งที่ต่อ Windows 11 ปกติได้?

ปัญหาแบบนี้มักเป็น RD Licensing grace period หมด (120 วันหลังติดตั้ง RDS Role) หรือ Remote Desktop User group ไม่มี user อยู่ ตรวจด้วยการเช็ค event log Microsoft-Windows-TerminalServices-Licensing/Admin บน server และเช็คสมาชิกของ Remote Desktop Users local group

Black Screen ใน RDP แก้ยังไงถ้าเปลี่ยนไดรเวอร์และปิด UDP แล้วยังไม่หาย?

ลอง Ctrl+Alt+End เพื่อเปิด Task Manager แล้ว launch explorer.exe ด้วยตัวเอง ถ้ายังดำอยู่ ให้ลบ cache RDP ที่ %LOCALAPPDATA%\Microsoft\Terminal Server Client\Cache แล้วลอง disable "Persistent bitmap caching" ใน mstsc → Experience tab สุดท้ายถ้ายังไม่ได้ อาจเป็น Indirect Display Driver ของ Nvidia/AMD ต้อง rollback ไปเวอร์ชันก่อนหน้า

RDP กับ SSH ต่างกันอย่างไร และควรเลือกใช้อะไร?

RDP เป็น graphical remote protocol ของ Microsoft (ทำงานที่ port 3389) เหมาะกับ Windows GUI, RDS farm, และ user desktop ส่วน SSH เป็น text-based protocol (port 22) เหมาะกับ Linux server administration และ automation ถ้า workload เป็น GUI Windows ใช้ RDP ถ้าเป็น shell/script ใช้ SSH: Windows 11 25H2 มี OpenSSH server built-in แล้ว สามารถ SSH เข้า PowerShell ได้ด้วย

Chen Wei
เกี่ยวกับผู้เขียน Chen Wei

Systems administrator who bridges the gap between users and the actual servers. Likes documentation almost as much as she likes coffee.