Bulk change of ACL folder owner

0

We have several thousand folders and sub-folders in quite a complex folder structure which we are backing up. Several hundred of these sub-folders have been flagged during the backup process as failing due to access problems. On further investigation, the folder owners have been changed, denying the backup service account the privilege to read data and alter the archive bit. I need a way of changing the folder owner on all of these sub-folders, without affecting the complex permissions hierarchy as I do not want to have to work through them one-by-one.
I've seen PowerShell examples dealing with permissions but the examples give do not directly relate to our specific scenario and I want to be sure that we get this right. I can see a folder's owner by using the

Get-Acl <path>

command on folders which do not have this problem, but when I use this on the problematic folders I get an error. I expected this as I'm logged in with my user account and have no idea who the folder owner is so cannot run this commend under that login.

Can anyone provide any guidance or an actual command for this please, or alternatively, is there another way of achieving this?

Rich M

Posted 2019-10-07T13:09:11.583

Reputation: 356

"I expected this as I'm logged in with my user account and have no idea who the folder owner is so cannot run this commend under that login." - There is a good chance they are all owned by the same owner, an Administrator account, should be able to determine who the owner is after adding themselfs to the ACL for the folder. – Ramhound – 2019-10-07T13:39:56.733

@Ramhound: Thanks for your comment, however, "adding themselves to the ACL for the folder" means going through them one-by-one which I want to avoid as there are hundreds. I want a way to replace the owner on all the problematic folders at once. – Rich M – 2019-10-07T14:01:15.897

Thank you @Moab! – Rich M – 2019-10-07T14:20:26.637

You can answer your own question using info in that reference if you wish, it will help others when searching this site. – Moab – 2019-10-07T14:26:52.690

@RichM - I was suggesting you do this for a single folder. To order to get the permissions required, to view the ACL, so you can determine who the actual owner of the folder is. – Ramhound – 2019-10-07T15:53:34.777

No answers