Created
May 24, 2013 14:36
-
-
Save davidroberts63/5643960 to your computer and use it in GitHub Desktop.
Powershell for setting folder permissions
This file contains 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
# This script function should work just fine. If you make modifications and notice that the 'Special Permissions' | |
# right is checked for the folder/file then see thise link for details on how to resolve that. | |
# | |
# http://blog.netnerds.net/2007/07/powershell-set-acl-does-not-appear-to-work/ | |
# | |
function Set-UserToModifyFolderPermission | |
{ | |
param( | |
[string]$fullPath, | |
[string]$username | |
) | |
# Set ACLs on full path for Read | Write | Modify for the username specified. | |
Write-Host Setting permissions for $username on $fullPath | |
$acl = Get-Acl $fullPath | |
$accessrule = New-Object System.Security.AccessControl.FileSystemAccessRule($username, "Modify, Synchronize", "ContainerInherit, ObjectInherit", "None", "Allow") | |
$acl.AddAccessRule($accessrule) | |
Set-Acl $fullPath $acl | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment