I am wondering if you are looking for something like the attached script...
This script tries get a share list for the system in order to determine
which share that a file was accessed by matching path names (the longest
path name that is shared that matched your pattern-match request) to
share-points and displays the data, optionally it can close the file(s) and
even more optionally, it can delete the file(s) in question...
You should bee able to use the string search option to find the share name
in question.. (BUT IT DOES NOT GUARANTEE THAT THIS IS ABSOLUTELY THE SHARE
THAT IT CAME FROM, because you may have nested shares).
It expects that you supply it an argument like SERVERNAME=SEARCHSTRING - or
- SERVERNAME=* to find all open files.
perl remotenetfile.pl SERVER=D:\\Path_to_share -stringsearch
It's pretty quick, and totally not ADSI related.
There are other options but you should be able to figure that out easily,
and add more if you want!
Steven
-----Original Message-----
From: Edward G. Orton [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 30, 2001 9:47 PM
To: [EMAIL PROTECTED]; Perl-Win32-Admin Mailing List
Subject: Re: Stupid ADSI tricks
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 01, 2001 12:14 AM
Subject: Stupid ADSI tricks
> From: Matthew Daly
>
> So I've been endeavoring to disconnect (almost) all the users from a
> sharepoint on a remote machine. In this quest, I'm indebted to Timothy
> Jackson for pointing me toward ADSI. But I'm still not _quite_ able to
get
> to where I want.
>
> The problem is that I don't want to indisciminately end all the sessions
> attached to this machine, just the ones that are associated with one
> specific share. The script that I have come up with (included below)
> checks all of the share's files that are open and disconnects only the
> sessions of those file's "owners". But even this is blunt (to say nothing
> of being s--l--o--w) because those sessions could be connected to other
> shares that I don't want to touch. (Also, although I don't know how
> important it is, it doesn't find users who are connected to the share but
> don't have any open resources.)
>
> It seems like there must be a better way. One of the properties of the
> share is the CurrentUserCount -- is there a way to identify which sessions
> comprise that count? Also, is there a class finer than sessions so that I
> can disconnect someone from a single share without affecting the rest of
> the session or the rest of the share?
>
Why not just 'unshare' the share? This will force users to disconnect from
the share, and yet not disrupt any other shares they are using. Once you do
with it what you need, then you can share it again. Quick, clean, and
relatively painless.
ego
Edward G. Orton, GWN Consultants Inc.
Phone: 613-764-3186, Fax: 613-764-1721
email: [EMAIL PROTECTED]
> Thanks,
> -Matthew
> [EMAIL PROTECTED]
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
remotenetfile.pl