question

Punkasur-0941 avatar image
0 Votes"
Punkasur-0941 asked AndreasBaumgarten edited

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

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-serverwindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered AndreasBaumgarten edited

Hi @Punkasur-0941 ,

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.