RDS Terminal Server Accumulates Orphaned 'Inactive TS Ports' from RD Easy Print Redirection
On Windows RDS/RDP terminal servers using RD Easy Print for local printer redirection, orphaned print ports labelled 'Inactive TS Ports' accumulate over time. These ports are created per user session for redirected printers but fail to clean up when sessions end, causing a growing list of stale port entries. Left unaddressed, excessive orphaned ports degrade print spooler stability and server performance. Resolution involves stopping the spooler, removing orphaned ports via Print Management MMC or registry cleanup, and implementing scheduled maintenance.
Indicators
- Growing list of print ports labelled 'Inactive TS Ports' visible in Print Management MMC or Devices and Printers
- Orphaned TS print ports remaining after RDP/RDS user sessions have ended
- Steady increase in stale port entries in the Windows print spooler over days or weeks
- Print spooler performance degradation or instability on heavily used terminal servers
- Event log entries from PrintSpooler source related to port creation/deletion failures at session disconnect
Likely causes
- RD Easy Print creates a temporary TS port for each redirected printer per user session, but the port cleanup process fails or does not run when the session disconnects or terminates
- Repeated user connect/disconnect cycles on the RDS terminal server cause cumulative accumulation of unreleased port objects in the spooler
- The Windows print spooler does not automatically garbage-collect Inactive TS Ports left behind by closed RDP sessions
- Abrupt session disconnections or network drops prevent proper session teardown and port cleanup routines from executing
Diagnostic steps
-
Open Print Management MMC: printmanagement.msc → expand Print Servers → [server name] → Ports. Count ports labelled 'Inactive TS Port'.Quantify the number of orphaned Inactive TS Ports currently present to assess the scope of the problem.
-
Run 'qwinsta' or 'query session' from an elevated command prompt to enumerate all active RDP/RDS sessions.Cross-reference active sessions against the Inactive TS Ports list to identify which ports are genuinely orphaned.
-
Open Event Viewer → Applications and Services Logs or System log, filter by source 'PrintSpooler'. Review errors/warnings around session disconnect times.Determine whether spooler errors are logged at session teardown that explain why port cleanup is failing.
-
Inspect registry: HKLM:\SYSTEM\CurrentControlSet\Control\Print\Monitors and HKLM:\SYSTEM\CurrentControlSet\Control\Print\Printers for residual TS port entries.Confirm the persistence mechanism of orphaned ports and identify registry artifacts requiring cleanup.
Resolution path
- Stop the Print Spooler service: run 'net stop spooler' or Stop-Service -Name Spooler from an elevated prompt before making any changes.
- Remove orphaned Inactive TS Port entries via Print Management MMC: right-click each confirmed orphaned 'Inactive TS Port' → Delete Port. For large-scale cleanup, script bulk removal using WMI or registry deletion.
- Restart the Print Spooler service: run 'net start spooler' or Start-Service -Name Spooler.
- Verify cleanup by reopening Print Management MMC and confirming no Inactive TS Ports appear for sessions that are not currently active.
- Implement a scheduled cleanup task (PowerShell or batch script) that enumerates and removes Inactive TS Ports during off-peak hours or triggered at session logoff.
Prevention
- Implement a scheduled logoff/cleanup script on the RDS server that enumerates Inactive TS Ports and removes those not associated with any currently active session, running at session logoff or on a nightly schedule.
- Evaluate Group Policy: Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Printer Redirection — limit redirected printers per session or disable Easy Print for users who do not require it.
- Monitor the total count of TS ports via a performance or alerting script and trigger remediation automatically when the count exceeds a defined threshold (e.g., 100 inactive ports).
- Consider disabling RD Easy Print for environments where printer redirection is not business-critical, using the GPO 'Use Remote Desktop Easy Print printer driver first' set to Disabled.
Tools
- printmanagement.msc — Print Management MMC for viewing and deleting TS ports
- qwinsta / query session — enumerate active RDS/RDP sessions
- net stop/start spooler — stop and restart the Windows Print Spooler service
- regedit / reg.exe — inspect and clean up residual registry entries
- Event Viewer — review PrintSpooler events for port creation/deletion errors