How can I unlock a folder locked by ‘System’ process on Windows Server 2008?

9

3

I'm on Windows Server 2008 64-bit. LockHunter identifies that a folder is locked by the "System" process. I'm not sure why this happens, but my bigger concern is how to unlock it. I'm looking for a solution that can be run from the command line.

LockHunter itself is unable to unlock it. Also, Sysinternals' Process Explorer doesn't find the locked folder's handle. Rebooting is not an option either.

alt text

ripper234

Posted 2009-10-07T16:27:56.530

Reputation: 9 293

For repeated occurrences where you can't track what's creating the file, try running ProcMon from the SysInternals suite, filtering down on a suitable Path and remembering to include the System process in the filter (which is excluded by default).

As you might need to leave it open for a while, choose Drop Filtered Events from the Filter menu.

When the file is touched you should see a CreateFile event. Opening up that event might reveal an "Impersonating" field with an associated username -- sometimes that might be enough of a clue to move you on. – Tim Barrass – 2015-03-12T12:36:25.613

This guy shares your view. http://scatteredideas.info/archives/delete-locked-files-32-and-64-bit/

– Nissan Fan – 2009-10-07T16:30:36.213

Have you looked at this question: How do I delete a ‘locked’ file in Vista 64?

– nik – 2009-10-07T16:35:19.480

It's not just any file, it's a file locked by System that's giving me the problem. I didn't have problems unlocking other files. – ripper234 – 2009-10-07T18:55:49.007

Answers

12

It turns out this was caused by another computer that had an open explorer shell on the "problematic" computer. This problem persisted even after a reboot! (not at first, but it reappeared)

The only solution was to close the relevant explorer window from the other computer.

ripper234

Posted 2009-10-07T16:27:56.530

Reputation: 9 293

2In my case my collegue created herself a shortcut for exe in shared folder and just used to launch it directly from network share. – Dmitriy Konovalov – 2013-02-08T11:09:39.803

2

usually it is because the file is open via file sharing. You can close that in computer management GUI / Shared folders / Open Files or via command line

net file - lists all open files

net file id /close

UPDATE: this command might work better in some cases:

openfiles /query /fo csv /v > c:\temp\files.csv -then open files.csv and search in it-

Vitas

Posted 2009-10-07T16:27:56.530

Reputation: 671

Nice. Worked perfectly for my situation. – Ƭᴇcʜιᴇ007 – 2018-09-27T12:45:26.050

1

If nothing else works, you may need to schedule an outage to reboot into safe mode and delete the file.

scott

Posted 2009-10-07T16:27:56.530

Reputation: 11

0

Logging other users off the server ended up releasing the lock for me.

KERR

Posted 2009-10-07T16:27:56.530

Reputation: 329

0

In my case, the fix was to check in Computer Management -> Shared Folders->Open Files who is locking those files and then end the session for them.

Hope it helps !

Alex

Posted 2009-10-07T16:27:56.530

Reputation: 1

0

Safe mode command window worked for me. Be sure to have your local admin password and Bitlocker key before proceeding.

GMcCaddon

Posted 2009-10-07T16:27:56.530

Reputation: 1

0

I don't think you can unlock any file locked by System.

Some utilities will only schedule deletes and renames for boot-time, as answered here already.

You might prefer to solve the causes for such locks, by searching using Process Explorer for the locking process. Once you know which system process it is, you may be able to disable it. For example, an always good candidate is Microsoft Search.

EDIT

If Process Explorer doesn't find the locking process, try EMCO UnLock IT, said to work on "Windows Vista and various x64 platforms".

harrymc

Posted 2009-10-07T16:27:56.530

Reputation: 306 093

@ripper234 I've had situations where process explorer finids that a folder is locked by system pid4, but then that doesn't help much 'cos it doesn't show what service is locking it. – barlop – 2019-01-18T19:36:55.457

2Process Explorer finds no locking process. – ripper234 – 2009-10-07T16:47:51.480

I edited in another possibility. – harrymc – 2009-10-07T17:32:14.153

0

Rebooting is sometimes all you need to do; if you haven't tried that yet, do so. If it's still locked when the system comes back online, then you can use a schedule-delete-for-boot utility.

quack quixote

Posted 2009-10-07T16:27:56.530

Reputation: 37 382