Mass Delete inactive TS ports in Windows Server

TS or the Terminal Server’s listening port are one of the major reasons Windows Servers tend to become unresponsive when they are inactive and for a normal server having such servers in good count is normal as it is admin who is responsible to configure all those things.

Now a good admin knows how to take care of this but even then doing this one by one can be a big issues. Apart from that one needs to find out  which ports are actually open before deleting them.

Thankfully, A developer at Codeplex has developed a tool which can mass delete these ports if given permission after it is listed or even without it. This will also make sure the issues with Printer Redirection also does not mess up things.

Delete Inactive TS Ports is a command line utility which has two options :

  • Lists down all the ports and
  • Delete the ports.

This is done by updating values in registry which is present mostly at HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{28d78fad-5a12-11d1-ae5b-0000f803a8c2} in format of #TS001 and so on and each of these values are set to Inactive TS Port. This tool takes advantage of this and lists down all the ports which carry this description. This also means if somebody changes them, it will not work as intended.

How to use this tool ?

  • Download from here.
  • Launch Command prompt with admin privilage
  • Naviagate to the folder where you download the tool.
  • Type in InactiveTSPortList /r to list all ports idle and  and To delete all the Inactive TS Ports  type TSPortList /d
List TS Ports
Inactive TS ports
In case you just want to drop all of them and you are pretty sure that you dont need to interact for each port. Download another version of the same file named as InactiveTSPortList.Standalone.WithoutPrompt.exe from here and just run it with full privilege.

InactiveTSPortList /r
To delete all the Inactive TS Ports from the systemInactiveTSPortList /d


  1. Hi Ashish, Do you know if this command can be run on a Windows 2012 R2 server?


Please enter your comment!
Please enter your name here