+ Post New Thread
Results 1 to 12 of 12
Windows Server 2008 R2 Thread, file in use in Technical; What's the windows equivalent of lsof please? I want to know what process is using a particular file....
  1. #1


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339

    file in use

    What's the windows equivalent of lsof please?

    I want to know what process is using a particular file.

  2. #2

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,802
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    Noting in the stock OS will do it. Try this though.

    Process Explorer

  3. Thanks to Geoff from:

    CyberNerd (22nd June 2012)

  4. #3

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,784
    Thank Post
    272
    Thanked 1,129 Times in 1,025 Posts
    Rep Power
    348
    Depends what file your trying to view - in windows you can use share and storage manager to view which user has files open on a share.

  5. Thanks to glennda from:

    CyberNerd (22nd June 2012)

  6. #4

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,802
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    True, but that doesn't give you the same information lsof does on *nix. Process Explorer does.

  7. #5

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,784
    Thank Post
    272
    Thanked 1,129 Times in 1,025 Posts
    Rep Power
    348
    Quote Originally Posted by Geoff View Post
    True, but that doesn't give you the same information lsof does on *nix. Process Explorer does.
    But if you are trying to locate which user has kept a file open from a shared drive share and storage manager is the ticket. I agree Process explorer will tell you a lot more info but for basic easy access the other thing works!

  8. #6


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    Thanks.
    I used intuition in the end. The problem was with a custom app and it was actually IIS holding a log file open..

    Don't suppose windows servers have anything as advanced as logrotate do they?

  9. #7

    Join Date
    Mar 2011
    Location
    Bournemouth
    Posts
    280
    Thank Post
    16
    Thanked 74 Times in 64 Posts
    Rep Power
    21
    Quote Originally Posted by CyberNerd View Post
    Thanks.
    I used intuition in the end. The problem was with a custom app and it was actually IIS holding a log file open..

    Don't suppose windows servers have anything as advanced as logrotate do they?
    /sarcasm?

    No it doesnt, because Windows services are supposed to use the Windows Event Log to log day-to-day activity not flat text files. Generally a windows installer will write to a log file as a one off and most services use the event log. There are always exceptions, but thats the fault of the service, not Windows.

  10. #8


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    Quote Originally Posted by ChrisMiles View Post
    /sarcasm?

    No it doesnt, because Windows services are supposed to use the Windows Event Log to log day-to-day activity not flat text files. Generally a windows installer will write to a log file as a one off and most services use the event log. There are always exceptions, but thats the fault of the service, not Windows.
    I suppose windows applications aren't supposed to use text files for configuring either.
    This app uses XML files for configuration and 'standard' log files for logging. Somehow it also requires IIS.

    without sed, grep and a decent test editor this is taking me 10 times longer than it should! I don't know how you windows admins put up with this O/S Linux is SO much easier !

  11. #9

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,784
    Thank Post
    272
    Thanked 1,129 Times in 1,025 Posts
    Rep Power
    348
    Quote Originally Posted by ChrisMiles View Post
    /sarcasm?

    No it doesnt, because Windows services are supposed to use the Windows Event Log to log day-to-day activity not flat text files. Generally a windows installer will write to a log file as a one off and most services use the event log. There are always exceptions, but thats the fault of the service, not Windows.
    Pretty sure IIS logs to C:\windows\system32\logfiles\W3SVC1 does it not? therefore microsoft don't follow there own principles! they do however create a new file for each day.

  12. #10

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,802
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    IIS logs flat files in 'C:\Windows\System32\LogFiles\W3SVC1' IIRC. I'd just use Cygwin tbh. However I did come across this script too.

    http://www.sapien.com/forums/scripti...s.asp?TID=1650
    Last edited by Geoff; 22nd June 2012 at 11:01 AM.

  13. #11


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    it isn't an IIS log. the log is from a 3rd party app, but since I couldn't lsof to find the process I shut down the whole of IIS.

  14. #12

    Join Date
    Jul 2006
    Location
    London
    Posts
    1,241
    Thank Post
    110
    Thanked 242 Times in 193 Posts
    Blog Entries
    1
    Rep Power
    74
    Might LogParser be able to help?

    Log Parser 2.2

    Also powershell can do regex though that is something I've never quite got the hang of. /hands in his sysadmin card.

  15. Thanks to psydii from:

    CyberNerd (22nd June 2012)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 11
    Last Post: 22nd January 2014, 10:11 AM
  2. Replies: 2
    Last Post: 2nd September 2011, 12:10 PM
  3. Replies: 2
    Last Post: 9th March 2011, 01:02 PM
  4. RIS Access denied file in use
    By kevin_lane in forum Windows
    Replies: 0
    Last Post: 7th January 2009, 09:17 AM
  5. Replies: 7
    Last Post: 20th July 2008, 09:38 AM

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
  •