Functions/FileSystem/Add-ACEtoACL.ps1
Function Add-ACEtoACL { [cmdletbinding()] Param ( # ACE Object [Parameter(Mandatory=$false)] [System.Security.AccessControl.FileSystemAccessRule] $ACE = (New-ACE), # ACL Object [Parameter(Mandatory=$false)] [System.Security.AccessControl.FileSystemSecurity] $ACL = (Get-ACL) ) Process { # Create original and new ACL object variants $origACL = $ACL $newACL = $ACL # Add ACE to new ACL $newACL.AddAccessRule($ACE) #COMPARE $origACL.Access | where IdentityReference -like "*kevin*" $newACL.Access | where IdentityReference -like "*kevin*" } } |