Page 1 of 1 1
Topic Options
#165772 - 2006-08-10 09:22 PM Detecting open files on network share
CCiolli Offline
Lurker

Registered: 2005-03-24
Posts: 3
Loc: OH
I have a script that maps, remaps and unmaps various network shares to the same drive letter(s). I would like to abort the unmapping of a drive if there are open files on the drive. How can I detect these open files?
Top
#165773 - 2006-08-10 10:11 PM Re: Detecting open files on network share
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Openfiles may be of use to you. It comes with XP.
_________________________
(... better days ahead)

Top
#165774 - 2006-08-11 09:51 AM Re: Detecting open files on network share
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Hmmm, nice idea but it doesn't work out of the box...
Code:
C:\Temp>openfiles

INFO: The system global flag 'maintain objects list' needs to be enabled to see
local opened files. See Openfiles /? for more information.


Files Opened Remotely via local share points:
---------------------------------------------
ERROR: Access is denied.


Top
#165775 - 2006-08-11 02:40 PM Re: Detecting open files on network share
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
Richard...Not sure why you are getting that... the docs say it works on network shares without turning on the local switch... this is what I get.

Code:
 
INFO: The system global flag 'maintain objects list' needs to be enabled to see
local opened files. See Openfiles /? for more information.
 
 
Files Opened Remotely via local share points:
---------------------------------------------
INFO: No shared open files found.




Another openfiles.exe thread with a little code to go with it
_________________________
(... better days ahead)

Top
#165776 - 2006-08-11 04:15 PM Re: Detecting open files on network share
CCiolli Offline
Lurker

Registered: 2005-03-24
Posts: 3
Loc: OH
Thanks for the tip on openfiles.exe. I didn’t know it existed. It should come in handy in the future.

I guess a little more info would have been in order. My user base is running W2K and XP. Also, openfiles.exe requires admin rights. Not a show stopper but W2K probably is.

I don’t care which files are open, I just want to make sure the end user doesn’t blow away a connection with open files on it.

KiXtart: use X: /delete
Windows: net use X: /delete
Both delete the network connection without warning even if files are open. The Windows GUI “Disconnect Network Drive” warns you if files are open.

Is there a WMI Class/Property that I might use?

Top
#165777 - 2006-08-11 11:25 PM Re: Detecting open files on network share
CCiolli Offline
Lurker

Registered: 2005-03-24
Posts: 3
Loc: OH
Already used openfiles to disconnect some Word file locks from a crashed Terminal Server session.

Thanks again!!!

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 847 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.031 seconds in which 0.013 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org