topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday April 24, 2024, 2:46 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Script to recursively add windows share permissions to many subfolders by name  (Read 3135 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
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

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,643
    • View Profile
    • Donate to Member

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Might well be 4WD.  You have much better memory than i do.   :-[