Change ACL's on a Parent folder for multiple SMB Paths from Traverse into Read permission

Punkasur 21 Reputation points
2021-04-16T15:19:05.967+00:00

Hi,

I am just starting to delve into powershell scripting. What i want to accomplish is to change folder permission from Traverse into Read permissions. One complication is i wanted to do this for several SMB paths (300~) so im thinking of powershell script to automate this for me.

The conditions are for Authenticated Users to have "Allow" Permissions for "This Folder Only ( parent folder only)" and change it from Traverse into "Read".

msdn link here https://social.msdn.microsoft.com/Forums/en-US/62b63fdf-3733-49a3-af83-557f08a70623/setting-multiple-acls-powershell?forum=winserverpowershell gave me an idea but just can't workout how to apply it for the number of different smb paths that i want to target.

Our smb shares path is typical where you got \servername\share\folder01 and folder number increments.

Thanks
punkasur

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 124.1K Reputation points MVP Volunteer Moderator
    2021-04-16T17:44:52.067+00:00

    Hi @Punkasur ,

    maybe this script will help. Just modify $maxCountvalue with the highest folder number. The variable $path contains the full smb share path, for instance \\servername\share\folder08
    You code needs to be added below or instead of the #add your code here - $path contains the smb name

    $maxCount = 19  
    $a = 1  
    Do {  
        $b = '{0:d2}' -f $a  
        $path = "\\servername\share\folder" + $b  
        $path  
        # add your code here - $path contains the smb share name  
        }   
    While (++$a -le $maxcount)  
    

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.