File sessions are not disconnecting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a file server that has multiple servers connecting to it to retrieve
files via UNC paths. The problem we are seeing is that after a few weeks, we
get a message that indicates that we have run out of connections. When I
look under Computer Management -> Shared Folders -> Sessions I can see that
there are many sessions with a 'connected since' date going back days or
weeks. If I disconnect them, file access speeds up and more connections are
allowed.

Is there any way to have these sessions automatically close when idle? Or
does anyone know a better way to do this?

Thanks.
 
I have a file server that has multiple servers connecting to it to retrieve
files via UNC paths. The problem we are seeing is that after a few weeks, we
get a message that indicates that we have run out of connections. When I
look under Computer Management -> Shared Folders -> Sessions I can see that
there are many sessions with a 'connected since' date going back days or
weeks. If I disconnect them, file access speeds up and more connections are
allowed.

Is there any way to have these sessions automatically close when idle? Or
does anyone know a better way to do this?

Thanks.

You could schedule the following batch to run every day:


@echo off
setlocal ENABLEDELAYEDEXPANSION
for /F "Tokens=1-8*" %%a in ('net sessions^|Find "\\"') do (
call :sess %%a %%b %%c %%d %%e %%f %%g %%h %%i
@echo !comp! !idle!
)
endlocal
goto :EOF
:sess
set comp=%1
set idle=00:00:00
:sessL
shift
if {%1}=={} goto sessT
set idle=%1
goto sessL
:sessT
for /f "Tokens=1 Delims=:" %%x in ('@echo %idle%') do (
if "%%x" GTR "01" net session %comp% /DELETE
)
 
Thank you Jerold. However, even if I disconnect them all (with net files
/delete /y or similar) they just come back. It is like the requesting
servers are keeping the connection alive for some reason.
 
Back
Top