Hi Richard,
A side note, I am deleting profile directories in this script, hence the takeown.exe use, some of the files give me access denied, or they will tell me it cant delete the folder because it is not empty,
when I look at the folder there is nothing there.
Sounds like you are getting Access Denied message before you take ownership of profile directories, which is normal.
Please take ownership first, then delete files.
Then out of nowhere if I close the folder and reopen it there is a file in there.
This happens after ownership is taken, after which I assume the account has enough permissions to see contents under the user profile folder.
Best Regards,
Amy
Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.