Link to home
Start Free TrialLog in
Avatar of Isaiah Melendez
Isaiah Melendez

asked on

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

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
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

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

ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial