Created
June 29, 2017 13:32
-
-
Save gravcat/93e3fc1f159647f48d80f98698c79f7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# must be run in administrator context | |
param ( | |
[String] $path, # file or folder | |
[String] $perm, # fullcontrol, read, write, etc | |
[String] $action = "allow" #allow or deny | |
[String] $user | |
) | |
$arguments = $user, $perm, $action | |
$acl = Get-Acl $path | |
$ar = New-Object system.security.accesscontrol.filesystemaccessrule($arguments) | |
$acl.SetAccessRule($ar) | |
$acl | Set-Acl $path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment