Skip to content

Instantly share code, notes, and snippets.

@danimr
Created March 19, 2015 13:03
Show Gist options
  • Select an option

  • Save danimr/447ee7a465ffaed1de1a to your computer and use it in GitHub Desktop.

Select an option

Save danimr/447ee7a465ffaed1de1a to your computer and use it in GitHub Desktop.

Revisions

  1. danimr created this gist Mar 19, 2015.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    $folder = 'C:\Temp\test.ps1'
    $grupo = "grupo"

    #quitar herencia
    $acl = Get-ACL -Path $folder
    $acl.SetAccessRuleProtection($True, $True)
    Set-Acl -Path $folder -AclObject $acl



    $Ar = New-Object system.security.accesscontrol.filesystemaccessrule($grupo,"FullControl","Allow")
    $Acl.SetAccessRule($Ar)
    Set-Acl $folder $Acl


    $accessrule = New-Object system.security.AccessControl.FileSystemAccessRule("users","Read",,,"Allow")
    $acl.RemoveAccessRuleAll($accessrule)
    Set-Acl -Path $folder -AclObject $acl