After using handle.exe you could use kill.exe from Pragma Systems
(I think that's where I got mine) to stop the process.  I've used this for
many processes that the Task Manager gives "Access Denied" on.  A good way
to get rid of a file lock without rebooting or even to stop a virus.
        Perl probably does it better but this works well too, with or
without a script.

On Thu, 5 Feb 2004, Gould, Kevin wrote:

> It's not Perl, but you can find open files using the utilities
> 
> Handle - from Sysinternals.com
> Or 
> Oh - from the Windows resource kits
>  
> 
> -----Original Message-----
> From: Dave Roth [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, February 05, 2004 12:34 AM
> To: Thomas Berk; Perl-Win32-Admin-Request (E-mail)
> Subject: RE: Closing open file sessions on a server
> 
> Both of the attached scripts are from my second book, "Win32 Perl
> Programming: Administrators Handbook"
> (http://www.roth.net/books/handbook/). The first one, openfiles.pl, will
> display all files that have been opened *remotely*. Unfortunately there
> is no easy way to discover all open file handles locally (nor would you
> want to since there would literally be hundreds).
> The other script (closefile.pl) will force closed a given file that has
> been opened remotely.
> For both files, pass in "-h" for help.
> 
> dave
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Thomas Berk
> Sent: Wednesday, February 04, 2004 10:29 AM
> To: 'Perl-Win32-Admin-Request (E-mail)'
> Subject: Closing open file sessions on a server
> 
> Does anybody have an example of how to identify and close open file
> locks.
> I have an application that's locking a db file on a Windows 2000 server.
> Users are inadvertently leaving themselves logged in over night
> preventing the file from being backed up.
> 
> I realize that there are risks in clearing these sessions from the
> server side, but I think the risk of missed backups at least warrants
> some testing (on something other than the live application db).
> 
> I've thought of using "net file" and parsing the output to produce "net
> file" commands to close the sessions.  Does anybody have a better idea?
> 
> Thomas
> 
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> 
> 
> 
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 

-- 
  Clint Mahoney
  The Herald-Times
  http://clintmahoney.com
  (812) 331-4236


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to