Thursday, May 05, 2005

Platform: Windows Server 2003 or Windows XP

As a cross platform guy, I spend a lot of time wishing this OS has that OS's feature, etc. Occasionally, I find myself looking for a basic lsof function in Windows. 'lsof' is the "list open files" function on Linux and UNIX type systems. For my particular need today, I was assessing which files are open on a Windows Server 2003 box and how to deal with them in a backup. I did some Google searching and eventually found out the command "openfiles" was added to the most recent Microsft OS's. To determine local file's that are open, go to a command prompt and use this command. One warning: You first have to issue a "openfiles /local on" command to enable a system global flag called 'maintain objects list' and reboot (yes, it's Microsoft). Then after reboot you can issue "openfiles /query" to see them. Note that openfiles will tell you which files are opened from remotely without the use of this flag, giving you the same information you would get from Computer Management -> Shared Folders -> Open Files. More details are available at the Microsoft Server 2003 Techcenter.