Which Process is locking a file RRS feed

  • Question

  • If I try to delete a file and get access denied (I am local admin)

    is there a powershell command/script which can tell me the process which is having a lock on the file?

    MSDNStudent Knows not much!

    Tuesday, March 27, 2012 9:23 AM


All replies

  • Hi,

    Not Powershell but should help:


    C:\>handle.exe c:\test.xlsx
    Handle v3.46
    Copyright (C) 1997-2011 Mark Russinovich
    Sysinternals - www.sysinternals.com
    EXCEL.EXE          pid: 3596   type: File           414: C:\test.xlsx
    Tuesday, March 27, 2012 9:33 AM
  • Mark Russinovich should really write his utilities as powershell commandlets. seriously!!

    The power of powershell would double/triple if all of his work was translated to powershell.

    MSDNStudent Knows not much!

    Tuesday, March 27, 2012 1:13 PM
  • problem is most of his utilities inject a driver so that it can read the
    kernel space.. kinda hard in powershell :)

    Justin Rich
    PowerShell V3 Guide (Technet)
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, March 27, 2012 1:22 PM
  • It would seem hypothetically that this could be done in powershell in windows server 2008. I don't have the answer but I would guess that there is a solution for this.

    Paul Jorgensen www.justcode.ca

    Wednesday, March 28, 2012 3:19 AM