- 逆向行駛 - https://520.be/ -

修復遠端桌面連線:發生內部錯誤

IMG_2026_07_23~09_41_13~1152x896

今天使用遠端桌面連線(兩端的OS都是Windows 10 LTSC, Build 19044.4529)突然出怪手,老是跳一個訊息顯示『發生內部錯誤』,拜請了一下Google大神發現大多文章什麼是要重啟winsock的、修改群組策略的,嘗試了一下都沒解決 🤷🤷‍♀️🤷 後來狠下心仔細去看M$官方的知識庫才順利解決,這邊留個筆記~ 🤖

發生內部錯誤

根據ref的第一篇的RDP連線來看,解決方法是從『步驟 2:設定 RDP 自我簽署憑證的正確許可權 [1]』開始跟著做

1. 在 PowerShell 實例中,逐一執行下列命令來更新 RDP 自我簽署憑證 👻

Import-Module PKI
Set-Location Cert:\LocalMachine
$RdpCertThumbprint = 'Cert:\LocalMachine\Remote Desktop\'+((Get-ChildItem -Path 'Cert:\LocalMachine\Remote Desktop\').thumbprint)
Remove-Item -Path $RdpCertThumbprint
Stop-Service -Name "SessionEnv"
Start-Service -Name "SessionEnv"

2. 重新啟動遠端桌面設定服務 👻

Stop-Service -Name "SessionEnv"
Start-Service -Name "SessionEnv"

3. 重設 MachineKeys 資料夾的許可權 👻

remove-module psreadline
md c:\temp
icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c > c:\temp\BeforeScript_permissions.txt
takeown /f "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys" /a /r
icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "NT AUTHORITY\System:(F)"
icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "NT AUTHORITY\NETWORK SERVICE:(R)"
icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c /grant "BUILTIN\Administrators:(F)"
icacls C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys /t /c > c:\temp\AfterScript_permissions.txt
Restart-Service TermService -Force

4. 啟用所有支援的 TLS 版本 👻

reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" /v Enabled /t REG_DWORD /d 1 /f

經過以上在PowerShell的操作後可以解決問題了 👽

ref.

列印本文 [5] 👨‍👩‍👧‍👦 1 次瀏覽