unknown
2008-11-19 15:00:37 UTC
I am using the following function:
# Add-AclTxt.MSH
# Add's an ACL to a file using text parameters
# Usage Add-Acl "File" "user" "Rights" ("deny")
# /\/\o\/\/ 2006
# http://mow001.blogspot.com
function Add-Acl {
Param ($folder,$user,
[System.Security.AccessControl.FileSystemRights]$Rights,
[System.Security.AccessControl.InheritanceFlags]$Inheritance="ContainerInherit,
ObjectInherit",
[System.Security.AccessControl.PropagationFlags]$Prop="None",
[System.Security.AccessControl.AccessControlType]$Access = "Allow")
trap{
Write-Warning "Something went wrong setting permissions"
Break
}
$ar = New-Object
System.Security.AccessControl.FileSystemAccessRule($user,$Rights,$Inheritance,$Prop,$access)
# check if given user is Valid, this will break function if not so.
#$Sid =
$ar.IdentityReference.Translate([System.Security.Principal.securityidentifier])
$acl = get-acl $folder
$acl.AddAccessRule($ar)
set-acl $folder $acl
}
When I try and set permissions on say D:\Shares and D:\Shares contains a
large amount of sub folders and files it can sometimes to hours to apply the
acl. Is this a powershell issues or ntfs permissions issue?? I'm migrating
rights for Novell land to Microsoft and it is taking far too long.
Thanks,
Jacob
# Add-AclTxt.MSH
# Add's an ACL to a file using text parameters
# Usage Add-Acl "File" "user" "Rights" ("deny")
# /\/\o\/\/ 2006
# http://mow001.blogspot.com
function Add-Acl {
Param ($folder,$user,
[System.Security.AccessControl.FileSystemRights]$Rights,
[System.Security.AccessControl.InheritanceFlags]$Inheritance="ContainerInherit,
ObjectInherit",
[System.Security.AccessControl.PropagationFlags]$Prop="None",
[System.Security.AccessControl.AccessControlType]$Access = "Allow")
trap{
Write-Warning "Something went wrong setting permissions"
Break
}
$ar = New-Object
System.Security.AccessControl.FileSystemAccessRule($user,$Rights,$Inheritance,$Prop,$access)
# check if given user is Valid, this will break function if not so.
#$Sid =
$ar.IdentityReference.Translate([System.Security.Principal.securityidentifier])
$acl = get-acl $folder
$acl.AddAccessRule($ar)
set-acl $folder $acl
}
When I try and set permissions on say D:\Shares and D:\Shares contains a
large amount of sub folders and files it can sometimes to hours to apply the
acl. Is this a powershell issues or ntfs permissions issue?? I'm migrating
rights for Novell land to Microsoft and it is taking far too long.
Thanks,
Jacob