Batch Kill / Delete a file locked by Explorer.exe
Posted on 2009-04-06
I am writing a script that searches and deletes all profiles out of the C:\Documents and Settings\ folder on all our citrix farm servers. Here is the basic module breakdown of the script:
1. Get input folder name
2. xcacls to remove all inherited permissions / write new permissions (just to make sure...probably not necessary)
3. Unlock files **
4. Delete Files
5. Write to log for verification.
Now, i have found 1 other script that make this work...1 that runs the search / delete / export log.
The problem is...there are some *.tmp files that are locked by explorer.exe that i can not get deleted. If i use a program like...unlocker.exe, it can delete them, but i cannot get the command line unlock to work with that program. So, i am needing a way to unlock all files in a folder that i can vbs script call / use.
Thanks in advance for your help.