RDP Troubleshooting & Debugging Guide
Quick Connectivity Tests
Mac/Linux - Test Port Connectivity
bash
# Test if port 3389 is reachable
telnet server-ip 3389
# Alternative with netcat
nc -zv server-ip 3389
# With timeout
nc -zv -w 5 server-ip 3389
Windows - Test Port Connectivity
cmd
# Test port connectivity
telnet server-ip 3389
# PowerShell alternative
Test-NetConnection -ComputerName server-ip -Port 3389
Server-Side Diagnostics (Azure VM)
1. Check RDP Service Status
powershell
# Check if RDP service is running
Get-Service TermService
# Start RDP service if stopped
Start-Service TermService
Set-Service TermService -StartupType Automatic
2. Check What's Listening on Ports
powershell
# See all listening ports
netstat -an | findstr LISTEN
# Check specifically for 3389
netstat -an | findstr :3389
3. RDP Registry Configuration
powershell
# Check if RDP is enabled (should be 0)
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -N
# Enable RDP if disabled
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -N
# Check Network Level Authentication setting
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
# Disable NLA temporarily (for troubleshooting)
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
# Check Security Layer
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
# Set to RDP Security Layer (less secure but more compatible)
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
4. Windows Firewall Check
powershell
# Check RDP firewall rules
Get-NetFirewallRule -DisplayName "*Remote Desktop*" | Select-Object DisplayName,En
# Enable RDP through Windows Firewall
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
# Command prompt alternative
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
5. RDP Listener Configuration
powershell
# Check RDP listener status
qwinsta /server:localhost
# Reset RDP listener if needed
qwinsta /server:localhost
6. Restart RDP Service
powershell
# Full RDP service restart
Restart-Service TermService -Force
# Or using net commands
net stop termservice /y
net start termservice
Client-Side Troubleshooting
Windows RDP Client Issues
Registry Fixes for Windows Client
cmd
# Disable NLA requirement on Windows CLIENT
reg add "HKLM\SOFTWARE\Microsoft\Terminal Server Client" /v AuthenticationLevelOve
# Allow older RDP versions
reg add "HKLM\SOFTWARE\Microsoft\Terminal Server Client" /v RDGClientTransport /t
Manual RDP File Configuration
Create a .rdp file with these settings for maximum compatibility:
full address:s:YOUR-SERVER-IP
authentication level:i:0
negotiate security layer:i:0
enablecredsspsupport:i:0
alternate shell:s:
shell working directory:s:
username:s:YOUR-USERNAME
domain:s:
password 51:b:
Mac RDP Client (Microsoft Remote Desktop)
Enable Detailed Logging
1. Open Microsoft Remote Desktop
2. Preferences → Advanced
3. Enable logging with Verbose level
4. Logs location: ~/Library/Logs/Microsoft Remote Desktop/
Connection Settings
Security: Set to "Any" or "RDP" (not NLA)
Color depth: Try 16-bit instead of 32-bit
Audio: Disable audio redirection
Alternative Mac Methods
bash
# Built-in Mac RDP
open rdp://server-ip
# Using Remote Desktop file
open file.rdp
Advanced Debugging
Event Log Analysis (Server)
Enable RDP Logging
powershell
# Enable Terminal Services logging
wevtutil sl Microsoft-Windows-TerminalServices-LocalSessionManager/Operational /e
wevtutil sl Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational
# View recent RDP events
Get-WinEvent -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Oper
Get-WinEvent -LogName "Microsoft-Windows-TerminalServices-RemoteConnectionManager/
Check Security Event Logs
powershell
# Check for authentication failures
Get-WinEvent -LogName Security | Where-Object {$_.Id -eq 4625} | Select-Object Tim
# Check for successful logins
Get-WinEvent -LogName Security | Where-Object {$_.Id -eq 4624} | Select-Object Tim
Network Debugging
Packet Capture (if needed)
powershell
# Start network capture (Windows Server)
netsh trace start capture=yes tracefile=rdp_trace.etl provider=Microsoft-Windows-K
# Stop capture
netsh trace stop
Check Network Adapter Settings
powershell
# Check network adapter configuration
Get-NetAdapter | Format-Table Name,Status,LinkSpeed
# Check IP configuration
Get-NetIPConfiguration
Common Error Solutions
"The remote computer disconnected the session"
Check server resources (CPU, Memory)
Verify user account has "Log on as a service" right
Check if multiple sessions are allowed
"Authentication failed"
Disable NLA temporarily
Check user credentials
Verify domain configuration
"Connection terminated by server"
Check server firewall
Verify RDP service limits
Check licensing issues
"This computer can't connect to the remote computer"
Network connectivity issue
Port 3389 blocked
Server not responding
Security Considerations
Temporary Security Reductions (for troubleshooting only)
powershell
# TEMPORARY - Disable NLA (re-enable after testing)
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
# TEMPORARY - Use RDP security layer
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
# REMEMBER TO RE-ENABLE SECURITY AFTER TESTING:
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\Win
Azure-Specific Solutions
Using Azure Portal
1. VM → Connect → RDP → Download RDP file
2. VM → Run command → RunPowerShellScript
3. VM → Serial console for direct access
4. VM → Reset password
Azure Bastion Alternative
If RDP continues to fail, consider using Azure Bastion for secure browser-based access.
Quick Reference Commands
Server Health Check Script
powershell
# Complete RDP health check
Write-Host "=== RDP Health Check ===" -ForegroundColor Green
Write-Host "1. RDP Service Status:" -ForegroundColor Yellow
Get-Service TermService | Format-Table Name,Status,StartType
Write-Host "2. RDP Registry Settings:" -ForegroundColor Yellow
$rdpEnabled = Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Termi
Write-Host "RDP Enabled (should be 0): $($rdpEnabled.fDenyTSConnections)"
$nla = Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Ser
Write-Host "NLA Setting: $($nla.UserAuthentication)"
Write-Host "3. Port 3389 Listening:" -ForegroundColor Yellow
netstat -an | findstr :3389
Write-Host "4. Windows Firewall RDP Rules:" -ForegroundColor Yellow
Get-NetFirewallRule -DisplayName "*Remote Desktop*" | Select-Object DisplayName,En
Write-Host "5. Recent RDP Events:" -ForegroundColor Yellow
Get-WinEvent -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Oper
Client Test Script
bash
#!/bin/bash
# RDP connectivity test script for Mac/Linux
SERVER_IP="YOUR-SERVER-IP"
echo "=== RDP Connectivity Test ==="
echo "Testing connectivity to $SERVER_IP:3389"
# Test basic connectivity
if nc -z -w5 $SERVER_IP 3389; then
echo "✓ Port 3389 is reachable"
else
echo "✗ Port 3389 is not reachable"
exit 1
fi
# Test with telnet
echo "Testing with telnet..."
timeout 5 telnet $SERVER_IP 3389
echo "If telnet connects but RDP fails, it's likely a protocol/authentication issu
Remember: Always re-enable security settings after troubleshooting!