Kill hung IIS windows FTP sessions

During some integration development some FTP sessions got created with keep alive on them, but how to remove them?

List active FTP sessions in IIS

Sounds simple, but was not so easy. The live sessions are listed in IIS under the ftp site in question. Select the site in IIS and then under FTP section, there should be a FTP Current Sessions. Double click will open a window with the current sessions in it.


It is possible to disconnect the sessions by right clicking them, you can restart the whole ftp site and yet the sessions will keep bouncing back, if they were set to keep alive when created.

How do we kill an active session?

To kill them Google comes up with lots of solutions for Linux and recommends the download of many different tools to do the job. Personally I don’t like installing tools on my production server, so I dug deeper, there had to be a way to do this using commands, I found there is!

List the connections using netstat

To view the sessions, open command prompt and issue the command:


netstat –ao

This will list all the sessions, look for the sessions that are of concern, the originator IP address will give them away. At the far right will be the process id for those sessions (PID). Note this for the sessions that need to go.

In our example the process on my server was PID 1672.

Kill the session using taskkill

Now we need to kill the FTP PID in windows. Use this command to do that:


taskkill /PID 1672 /F /T

Where the command switches are F= Force and T=Terminate and 1672 is the process ID on your server that you obtained earlier from the netstat command.

Check back in the FTP sessions window and the sessions should be gone forever.

I hope this was useful to you, do comment if it was!