Locked files line up for changes

Use MoveFileEx, which lets a program queue up changes to locked files at the next reboot, or try the freeware command-line tool, PendMoves.

This tip was submitted to SearchWinSystems.com by expert Serdar Yegulalp. Please let other users know how useful it is by rating it below.


When a program installer, a hotfix or a service pack wants to make changes to a system, the changes usually involve files that the system has locked and can't be changed automatically.

Windows has an API called MoveFileEx that lets a program queue up changes to be made to locked files the next time the system reboots. This is why many installers require that you reboot the computer to make the program functional: some of the files that the program needs may not yet actually be installed until the next reboot.

It's not always easy to tell offhand what files have been added or replaced; the timestamps on files can be misleading, and tracking down the changed files after the fact is tedious and time-consuming. A list of the files you need to add, change or delete are added to the Registry under the key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations.. The Session Manager iterates through this list at startup and makes the changes listed.

If you don't feel like digging through the Registry, the ever-prolific Mark Russinovich of the Sysinternals site has also developed a freeware command-line tool called PendMoves.

PendMoves dumps out the contents of the pending rename/delete values in the key, and also iterates through the files to be changed and reports an error if one of them isn't available. This can be handy as a way to automatically report out changes to be made to files as part of an installation control script, or for simple system auditing (such as if you want to see if a particular program does in fact make certain changes).

PendMoves can be downloaded at http://www.sysinternals.com/files/pendmoves.zip and also includes a utility called Movefile, which lets you specify your own files to be replaced at the next boot.


Serdar Yegulalp is editor of the Windows Power Users Newsletter. Check it out for the latest advice and musings on the world of Windows network administrators -- and please share your thoughts as well!


This was first published in November 2004

Dig deeper on Windows Operating System Management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close