+ Post New Thread
Results 1 to 10 of 10
Scripts Thread, Script to find who has a file open on a network share in Coding and Web Development; I have looked and can't find this anywhere... Has anyone got a script they can send me that allows you ...
  1. #1
    JamesBanks7's Avatar
    Join Date
    Dec 2013
    Location
    Teesside
    Posts
    42
    Thank Post
    3
    Thanked 12 Times in 11 Posts
    Rep Power
    37

    Script to find who has a file open on a network share

    I have looked and can't find this anywhere...

    Has anyone got a script they can send me that allows you to check who has a certain file open on a network share ?
    Important updates have been made on one of the documents by HR/Finance but somebody has it open and for the life of me can't find who

  2. #2
    jmcdermott's Avatar
    Join Date
    Feb 2008
    Location
    Cornwall
    Posts
    164
    Thank Post
    16
    Thanked 41 Times in 33 Posts
    Rep Power
    20
    May be a stupid reply but have you tried looking in the 'Shares and Storage Management' on the server holding the shares.

  3. 2 Thanks to jmcdermott:

    JamesBanks7 (7th February 2014), mac_shinobi (7th February 2014)

  4. #3

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,218
    Thank Post
    2,769
    Thanked 935 Times in 875 Posts
    Rep Power
    343
    Quote Originally Posted by jmcdermott View Post
    May be a stupid reply but have you tried looking in the 'Shares and Storage Management' on the server holding the shares.
    I was thinking along similar lines - can you not use computer management --> Shared Folders -->

    Either under sessions or open files should show you who has what open and you can right click on the relevant items and click disconnect

    Not sure if its the same now on a Server OS ?

  5. Thanks to mac_shinobi from:

    JamesBanks7 (7th February 2014)

  6. #4
    JamesBanks7's Avatar
    Join Date
    Dec 2013
    Location
    Teesside
    Posts
    42
    Thank Post
    3
    Thanked 12 Times in 11 Posts
    Rep Power
    37
    @mac_shinobi @jmcdermott Thanks guys, yes I have tried this but on the open files it said nobody had the file open so that's why I thought possibly there may have been a script to see if there was anything that wasn't getting picked up on the Computer Management

  7. #5

    Join Date
    May 2012
    Location
    Cornwall
    Posts
    19
    Thank Post
    3
    Thanked 2 Times in 2 Posts
    Rep Power
    4
    This should find it from the commandline

    openfiles.exe /query /s <server>

    Then followup with the /op <filename> paramater if needed to clear the lock

    Openfiles
    Last edited by Mayki5; 7th February 2014 at 12:05 PM.

  8. #6

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,310
    Thank Post
    331
    Thanked 1,192 Times in 814 Posts
    Blog Entries
    2
    Rep Power
    1065
    Quote Originally Posted by mac_shinobi View Post
    ...Not sure if its the same now on a Server OS ?
    Server 2012 here:


  9. Thanks to DaveP from:

    mac_shinobi (7th February 2014)

  10. #7
    ascott2's Avatar
    Join Date
    Nov 2007
    Posts
    174
    Thank Post
    18
    Thanked 36 Times in 28 Posts
    Rep Power
    20
    There is a command built into Windows for this. Run Powershell as Administrator and run openfiles.

  11. #8

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,218
    Thank Post
    2,769
    Thanked 935 Times in 875 Posts
    Rep Power
    343
    Not related to the OP but tried running a command prompt as administrator ( right click --> run as admin ) and also shift and right click to run as another user using a domain admin account and I get this message :

    C:\windows\system32>openfiles /local

    INFO: The system global flag 'maintain objects list' is currently disabled.

  12. #9
    ascott2's Avatar
    Join Date
    Nov 2007
    Posts
    174
    Thank Post
    18
    Thanked 36 Times in 28 Posts
    Rep Power
    20
    openfiles /local are local file handles by the local machine and users, and by default machines don't audit them. You can switch it on running "openfiles /local on" or just try running openfiles without the /local switch. See here for further details Openfiles

  13. Thanks to ascott2 from:

    mac_shinobi (10th February 2014)

  14. #10
    JamesBanks7's Avatar
    Join Date
    Dec 2013
    Location
    Teesside
    Posts
    42
    Thank Post
    3
    Thanked 12 Times in 11 Posts
    Rep Power
    37
    Hi Guys thanks for your help.
    The issue is resolved now, we have a dual OS running through Vmware fusion and a staff member had the documents open on Windows but then put the windows OS to sleep and continued to work on the secondary OS

    Thanks for all your help !!

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 4
    Last Post: 12th February 2012, 11:26 PM
  2. Script to Find and Replace within an INI file.
    By timethrow in forum Scripts
    Replies: 1
    Last Post: 4th February 2012, 10:17 AM
  3. Script to find serial numbers of all computers on network
    By bandgeekmafia78 in forum Scripts
    Replies: 3
    Last Post: 23rd May 2011, 05:11 PM
  4. Replies: 3
    Last Post: 18th January 2008, 01:46 PM
  5. Replies: 4
    Last Post: 25th December 2006, 09:15 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •