troubleshooting Question

How to set share permission on folders - Everyone Permission

Avatar of SAM IT
SAM IT asked on
SecurityScripting LanguagesPowershell
20 Comments1 Solution2690 ViewsLast Modified:
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
}
ASKER CERTIFIED SOLUTION
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 1 Answer and 20 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros