Avatar of SAM IT
SAM IT

asked on 

How to set share permission on folders - Everyone Permission

Hello Sir,

Below script is working perfectly,  applying security group permission correctly .
My requirement is created folders should have  everyone shared permission on the folders, please help
_____________________________________________________________

Set-Location "C:\Users\narasimha.s\Desktop\foldertest"
$Folders = Import-Csv C:\Users\Narasimha.s\Desktop\foldertest\project.csv
ForEach ($Folder in $Folders) {
    $newFolder = New-Item -name $Folder.Name -type directory
    $acl = Get-Acl $newFolder.FullName

    $ace = New-Object System.Security.AccessControl.FileSystemAccessRule('Domain\shr-projectsnew', 'Modify,Synchronize', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
    $acl.AddAccessRule($ace)

    Set-Acl $newFolder.FullName -AclObject $acl
}
SecurityPowershellScripting Languages

Avatar of undefined
Last Comment
SAM IT

8/22/2022 - Mon