File sessions are not disconnecting

G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

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.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

On Fri, 3 Jun 2005 09:28:07 -0700, "Ryan Smith" <Ryan Smith@discussions.microsoft.com> wrote:

>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
)
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

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.

"Jerold Schulman" wrote:

> On Fri, 3 Jun 2005 09:28:07 -0700, "Ryan Smith" <Ryan Smith@discussions.microsoft.com> wrote:
>
> >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
> )
>