Tech

PowerShell How to add permission to files and folder structure

I got the below script online which is need to be added this script will add a " modify " permission to a specific user on ALL folders and Files individually in a specific file structure due to an inheritance block on most of the folders.

$acl = Get-Acl c:\demofolder

$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("mydom.com\test","modify","Allow")

$acl.SetAccessRule($AccessRule)

$acl | Set-Acl c:\projectfolder