Killing outgoing TCP sessions

Hello all,

We have a windows 2003 server. This server is running some scripts for the clients. Theese scripts are leaving connections open, to much connect. Windows Xp cannot have more then 10 server connections.

What I want , I want to kill all TCP connections as quick fix. I can do this though disabeling and enabling the network card or rebooting.
I want to disable and enable scripted the network card. But I don't know how.

As final solution we will rewrite all the script to resolve all problems, but this takes to long.

PLease help me..
Who is Participating?
If the clients are using DHCP, you could try the following:

ipconfig /release
ipconfig /renew

If that doesn't work, you'll need to use netsh -
You are saying that the script connects to an XP machine, and the XP becomes the "server connection" at that point?  Which is why you are limited to 10 client connections to that XP box, right?

Just making sure, since you are also talking about 2003 server in your post.

Any script that will disable and renable the NIC obviously has to be run locally on the XP workstation in question, since once you disable it, you won't be able to re-enable it remotely (since you won't be able to get to it).

That said, here's two scripts.  One using simple net commands, the other vbscript.  All that needs to be done is to stop and start the Server service on the XP workstation.  That will kill any client connections to that box.

SCRIPT #1: (save as batch file and run on the XP machine.)

net stop server
net start server

(that's it, lol)

SCRIPT #2: (save as .vbs and run on the XP machine)

Option Explicit
Dim objShell, intShortSleep, intLongSleep
Dim strService
Set objShell = CreateObject("WScript.Shell")

' Values set
strService = " Server"
intShortSleep = 1500
intLongSleep = 5500

' Cmd prompt opened
objShell.Run "cmd"
Wscript.Sleep intShortSleep

' Service stopped with 'Net' command
objShell.SendKeys "net stop" & strService
Wscript.Sleep intShortSleep
objShell.SendKeys "{Enter}"
Wscript.Sleep intLongSleep

' Service started with 'Net' command
objShell.SendKeys "net start" & strService
Wscript.Sleep intShortSleep
objShell.SendKeys "{Enter}"
Wscript.Sleep intLongSleep

' Cmd prompt exited
objShell.SendKeys "Exit"
Wscript.Sleep intShortSleep
objShell.SendKeys "{Enter}"

Wscript.Echo strService & " service restarted"

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.