We help IT Professionals succeed at work.

Powershell 3.0 - Add Group/Username and Enable Full Control permissions

sj77
sj77 asked
on
169 Views
Last Modified: 2017-03-27
I am needing a script to add in a user. Let's say everyone into the security properties of a directory.

Directory: C:\CBASYNC
User: Everyone
Permissions needed: Full Control

How would I write this out in powershell?
ps_properties.png
Comment
Watch Question

Chris DentPowerShell Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
This creates and adds the access control entry.
$acl = Get-Acl "C:\CBASYNC"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
    'Everyone',
    'FullControl',
    'ObjectInherit,ContainerInherit',
    'None',
    'Allow'
)
$acl.AddAccessRule($accessRule)
Set-Acl "C:\CBASYNC" -AclObject $acl

Open in new window

PowerShell Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION