Sign in with
Sign up | Sign in
Your question

Close Established Connections From Command Line

Last response: in Networking
Share
August 7, 2005 6:43:04 AM

Hi Everybody !

Win2003.
Does anybody know of a utility (Microsoft or 3rd party) or some script (vbs\wsh etc) that will allow an admin to close ESTABLISHED connections FROM THE COMMAND LINE ?

Netstat output example:
Proto Local Address Foreign Address State
TCP xxx.xxx.xxx.xxx:1186 xxx.xxx.xxx.xxx:80 CLOSE_WAIT
TCP xxx.xxx.xxx.xxx:4854 xxx.xxx.xxx.xxx:5631 LISTENING
TCP xxx.xxx.xxx.xxx:4854 xxx.xxx.xxx.xxx:5631 ESTABLISHED

The empathies is closing the connection, NOT the active process\service.

The above is needed in order to run a batch file on the server (via a remote control utility in a console like mode-the server is the host-remote is WinXP) which includes closing the established connection (The process closes
the active remote control session and waits for another connection), and running several commands.
True-this can be done by killing\closing the application or by stopping the service, but the solution suggested is
Quicker (less then 1 second to close the connection vs. a few seconds to close the application\stop the service),
Has much less potential for problems (Who among us hasn't came across a program\service which refused to load, with little or no error message, and started pulling out what little hair he had left...),
And imho, is more precise, concise and to-the-point.

I've googled long and deep and found no such utility.
(Hopefully) It exists in in some small corner of some small
integration\networking package.
Has any body seen\heard of such a utility ?

P.S: Unfortunately, I haven't mastered the scripting writing art to date.
If somebody could help out with a small\no-nonsense script (which closes a single existing established connection in one constant port without any need for user input\command line switches) I'd be very much obliged.
!