To describe the problem: We have a folder called Users on a Windows 10 file-share system. In it are about 50 subfolders each named for the exact same name as the user that should have read/write access to it. Occasionally I have had to add someone as a Master to the Users folder with control over all the subfolders and when I do Windows often will change the write access for all subfolders by adding the new Master but in doing so it removes the write access for each user for their own sub-folder. To fix this requires going to each subfolder, clicking down to properties and sharing permissions and adding read/write access back to that one folder for its user. Then going to the next for 50 or more Users.
is there a way I could script this process so that it would read the name of the folder and add the user by that name to have read/write access to their folder. ie: in the Users folder - For the subfolder named johnsmith it should add read/write access for the user named johnsmith then larrybarns would get read write access to the subfolder named larrybarns and so on through all 50. While doing this it should not change any permissions that already exists for these folders.
If this had not happened more than once already I would not bother to ask. But since it has I figure there has to be some way faster than going folder by folder clicking to get to the "share permissions", and typing in each users name to add them back to their own folder