We have a Word file residing on a Windows 2008 R2 Standard server that is used by many people in our company. Every night, one designated person needs to be able to update this file. Frequently, they try to update it and someone has the file still open on their computer, so the updating person gets the message "File is in use. XYZ.doc is Locked for Editing by "Smith, John". The person who is trying to update the file does not have administrative access to the Server in order to clear the lock. I am looking for a way - possibly through a batch file or otherwise - that I can give the updating person the ability to clear the locked file so that they are able to edit it. By the way, the file ALWAYS reads that it is locked by "Smith, John" no matter which user has it open, making it impossible to find the offending computer. I prefer that the updating person is able to clear it anyway without having to find a computer and log it off. Any ideas would be appreciated!
https://technet.microsoft.com/en-us/library/cc732037.aspx
net file will get you the list of files.
net file <id> /close will close the file for you.
This would need to be run on the server itself. I guess you could use PsExec to get around that.
If it's the same file you could use some kind of loop or filter (find?) to get the filename in question, and then if it exists close it.
Hope that helps.