Delete files that windows don't want to delete?
At my company, we write a script for simple tasks that we usually do by hand. I am using C # to delete profiles in c: \ documents and settings \ except for a few. They'll just be left alone. The problem is that even with code that sets the files back to normal and marks the admin user as owner, they won't delete. They say the quickstart folder access is denied. I am using recursive permissions method and I know it works. It's the same with file attributes. Why doesn't it work? How to fix it?
a source to share
The problem might be that other processes have open handles for those files or directories. To find out which processes are to blame, you can use Process Explorer's search feature to find them.
(Just to be clear: this is not a suggestion for how you can write code to delete files, but a suggestion for how to figure out exactly what is preventing your current system from working.)
a source to share
You can check if this is caused by file locking and not access control by downloading the Process Explorer tool from http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx p>
Run as administrator and use Find-> Handle or Dll to make sure it is locked.
Otherwise, you will be able to take ownership and grant uninstall access without issue.
a source to share