HI!! This is my first post and I should have signed up ages ago. Newb here =)
If I run this script, only the last object gets added (Senior Accountant) to the ACL. How can I fix this?
$Acl = Get-Acl “C:\MyFolder”
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\HR Staff”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Budget Analyst”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\dbtest”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Volunteer Coord”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Admin Project Manager”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Database Programmer”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Finance Director”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\HR Manager”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Office Coordinator”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Payroll Accountant”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Accounting Manager”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Accounting Staff”, “Modify”,“Allow”)
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule (“03NH\Senior Accountant”, “Modify”,“Allow”)
$Acl.SetAccessRule($Ar)
Set-Acl “C:\MyFolder” $Acl
Thanks!!