To fix RDP "An internal error has occurred" in Windows Server: Reset the Remote Desktop service and regenerate corrupted cryptographic keys by running Restart-Service TermService -Force in an administrative PowerShell console, restore NTFS permissions on C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys to grant Full Control to Administrators and System, and set the registry DWORD SecurityLayer to 1 (Negotiate) or 2 (TLS) under HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp.[1][2]
Follow this system administrator guide to diagnose TLS handshake timeouts, repair corrupted RSA key stores, and re-establish secure Remote Desktop connections across Windows Server 2025, 2022, 2019, and cloud VPS instances.[1][3]
What Triggers RDP An Internal Error Has Occurred in Windows Server?
Unlike network-level timeouts or explicit password rejections, “An internal error has occurred” is an opaque client-side error emitted by mstsc.exe when the Remote Desktop Protocol handshake aborts before session initialization completes.[1][2]
+-------------------------------------------------------+
| Client (mstsc.exe) |
| 1. TCP SYN on Port 3389 ---------------------------> |
| 2. X.224 Connection Request (TLS Negotiation) -----> |
| |
| Server (TermService) |
| <---- Fails to Access RSA Private Key in MachineKeys |
| <---- TLS Cipher / SecurityLayer Mismatch |
| |
| Handshake Aborted at Transport Layer |
| Client Dialog: "An internal error has occurred" |
+-------------------------------------------------------+
The underlying failure typically stems from one of four infrastructure conditions:[1][4]
- Corrupted Self-Signed RDP Certificate: The self-signed X.509 certificate generated by Windows Server has expired, become corrupted, or lost its link to the private key.[2]
- Damaged MachineKeys ACLs: The
TermService(Network Service account) cannot read or write private keys in theC:\ProgramData\Microsoft\Crypto\RSA\MachineKeysdirectory due to altered file system permissions.[3] - SecurityLayer Protocol Mismatch: The server is configured to require legacy RDP encryption (
SecurityLayer = 0) or strict SSL/TLS (SecurityLayer = 2) that conflicts with client cipher policies.[4] - Session / Port Exhaustion: Dangling disconnected sessions or dead TCP sockets prevent the Terminal Services listener from spawning a new virtual channel.[1]
For enterprises hosting mission-critical accounting or trading software on Pakistan dedicated bare metal or high-memory international servers, diagnosing RDP failures requires out-of-band IPMI, VNC console access, or remote PowerShell management.[1]
Diagnostic Matrix: RDP Internal Error Root Causes
| Root Cause | Indicative Event Log ID | Primary Diagnostic Check | Resolution Action |
|---|---|---|---|
| Corrupted Certificate | Event ID 1057 (TermService) |
certlm.msc > Remote Desktop |
Delete invalid certificate; restart TermService to regenerate.[2] |
| MachineKeys Permission Denial | Event ID 1058 (TermService) |
icacls C:\ProgramData\...\MachineKeys |
Grant NETWORK SERVICE and Administrators Full Control.[3] |
| Security Layer Mismatch | Event ID 56 (TermDD) |
Registry WinStations\RDP-Tcp\SecurityLayer |
Set SecurityLayer to 1 (Negotiate) or enforce TLS via Group Policy.[4] |
| NLA Authentication Block | Event ID 4625 (Security Audit) | Registry UserAuthentication |
Temporarily toggle UserAuthentication = 0 to verify credential handshake.[1] |
| Client Device Redirection Deadlock | Client-side timeout | Inspect mstsc Local Resources tab |
Disable printer, smart card, and audio redirection in RDP client.[1] |
Step-by-Step Action Plan: Fix RDP An Internal Error Has Occurred in Windows Server
Because standard RDP access is severed, execute these steps via your VPS Web VNC console, IPMI KVM, Hyper-V console, or remote administrative PowerShell (Enter-PSSession).[1]
Step 1: Restart Remote Desktop Services and Clear Hung Sockets
Open an administrative PowerShell prompt on the target server:
# Inspect the operational state of TermService
Get-Service -Name TermService, SessionEnv, UmRdpService
# Forcefully restart the Terminal Services subsystem
Restart-Service -Name TermService -Force
Verify that the listener is actively waiting on TCP port 3389:
Get-NetTCPConnection -LocalPort 3389 -State Listen
Expected Output:
LocalAddress LocalPort RemoteAddress RemotePort State OwningProcess
------------ --------- ------------- ---------- ----- -------------
0.0.0.0 3389 0.0.0.0 0 Listen 1448
Step 2: Regenerate the Remote Desktop Self-Signed Certificate
Corrupted certificate thumbprints in the registry represent the single most common cause of Event 1057 and internal handshake abortion.[2]
- Open the Local Computer Certificate Store:
certlm.msc - Navigate to Remote Desktop > Certificates.[2]
- Select the expired or corrupted self-signed certificate, right-click, and select Delete.[2]
- Restart
TermServiceto trigger automatic certificate recreation:Restart-Service -Name TermService -Force - Refresh the Certificate snap-in to confirm that Windows Server has provisioned a clean certificate with a new RSA 2048-bit key.[2]
Step 3: Repair NTFS Permissions on the RSA MachineKeys Directory
Windows Server stores the cryptographic private keys for machine certificates in a protected system folder.[3] If security hardening scripts or software installations alter its Access Control List (ACL), the RDP service cannot read the server certificate.[3]
Verify and reset permissions using icacls:
# Inspect existing permissions
icacls "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys"
# Restore mandatory operational permissions
takeown /f "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys" /a
icacls "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys" /grant "Administrators:(OI)(CI)F" /grant "SYSTEM:(OI)(CI)F" /grant "NETWORK SERVICE:(OI)(CI)F" /grant "Everyone:(R)"
Restart TermService following the ACL adjustment.[3]
Step 4: Adjust RDP SecurityLayer and NLA in the Windows Registry
If client and server cryptographic cipher suites disagree during the initial TLS handshake, configuring the server to negotiate resolving the connection deadlock.[4]
Execute the following PowerShell commands to inspect and update the RDP-Tcp listener properties:
$Path = "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
# SecurityLayer values: 0 = RDP Encryption, 1 = Negotiate (Default), 2 = SSL/TLS
Set-ItemProperty -Path $Path -Name "SecurityLayer" -Value 1 -Type DWord
# Verify Network Level Authentication (NLA)
# Set to 0 temporarily if diagnosing Kerberos/CredSSP ticket failures
Set-ItemProperty -Path $Path -Name "UserAuthentication" -Value 1 -Type DWord
Alternatively, configure this globally via Group Policy (gpedit.msc):
- Navigate to:
Computer Configuration>Administrative Templates>Windows Components>Remote Desktop Services>Remote Desktop Session Host>Security. - Enable Require use of specific security layer for remote (RDP) connections and set the policy to Negotiate.[4]
Step 5: Disable Client-Side Resource Redirection in mstsc
On your client workstation, resource conflicts involving local printers, smart cards, or high-definition audio redirection can cause the connection pipeline to crash before drawing the desktop.[1]
- Launch
mstsc.exeon your local PC. - Click Show Options and open the Local Resources tab.
- Under Remote audio, click Settings… and select Do not play.[1]
- Under Local devices and resources, uncheck Printers and Clipboard.
- Click More… and ensure Smart cards, Ports, and Drives are unchecked.
- Reconnect to the Windows Server instance.[1]
Pro Tips and Common Pitfalls
Pro Tip: If your server is connected to an Active Directory domain and you encounter "An internal error has occurred" specifically when connecting over a VPN or WAN, inspect the Maximum Transmission Unit (MTU) size. Fragmented Kerberos tokens or large TLS packets can be silently dropped by intermediate routers. Lower the MTU on your server's network adapter from 1500 to 1420 using netsh interface ipv4 set subinterface "Ethernet" mtu=1420 store=persistent to prevent silent transport packet loss.
Critical Pitfall: Never delete the entire C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys directory itself. This folder contains the cryptographic keys for IIS, BitLocker, Windows Update, and Active Directory machine account certificates. Only delete files inside it if you have verified the specific GUID corresponding to the corrupted Terminal Services certificate, or simply delete the certificate from certlm.msc as detailed in Step 2.[3]
Frequently Asked Questions (PAA)
What event log captures the exact cause of RDP internal errors on Windows Server?
Open Event Viewer (eventvwr.msc) on the server and check two specific logs:
Applications and Services Logs>Microsoft>Windows>TerminalServices-LocalSessionManager>Operational(tracks session connect/disconnect events).[2]Windows Logs>Systemfiltered by Source TermService or TermDD (reports certificate generation failures, Event ID 1057, and socket errors).[2]
Does disabling Network Level Authentication (NLA) fix the internal error?
Disabling NLA (UserAuthentication = 0) can bypass transient CredSSP encryption oracle failures and Kerberos authentication clock skew issues.[1] However, NLA should be re-enabled once the underlying certificate is repaired, as NLA protects the server from unauthenticated denial-of-service and brute-force attacks.[4]
Why does RDP work locally on localhost but fail across the network?
If mstsc /v:127.0.0.1 succeeds on the server console but remote IP connections fail with an internal error, the issue is caused by an intermediate firewall dropping fragmented TLS negotiation packets, a third-party antivirus endpoint filter corrupting RDP packets, or missing Windows Defender Firewall exceptions for port 3389.[1]
Deploy Reliable Windows Remote Desktop Infrastructure
Experience ultra-low latency and rock-solid enterprise virtualization with Nextgen Hosting. Discover high-performance Windows Server VPS and dedicated bare metal instances with IPMI KVM out-of-band management.
Pakistan Bare Metal Servers • Global Dedicated Infrastructure • Dedicated Windows RDP Plans
Disclaimer: This post is for informational and educational purposes only, accurate to the best of our knowledge at publication. Modifying Windows Registry parameters and certificate stores carries operational risks. Nextgen Hosting accepts no liability for server misconfigurations or administrative lockouts resulting from reliance on this content.
Sources & Official References
- Microsoft Learn - Troubleshoot Remote Desktop disconnected errors and general connectivity: https://learn.microsoft.com/en-us/troubleshoot/windows-server/remote/troubleshoot-remote-desktop-disconnected-errors
- Microsoft Technical Support - Event ID 1057 and Terminal Services certificate regeneration: https://learn.microsoft.com/en-us/troubleshoot/windows-server/remote/remote-desktop-listener-certificate-configurations
- Microsoft Security Guidance - Default permissions for the MachineKeys directory: https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/default-permissions-machinekeys-folders
- Microsoft Learn - Configure authentication and encryption for Remote Desktop connections: https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-security
