1
2
3
4
5
6
7
8
9
10
11
12
| Function Set-FTPACL
{
Param ($FTPUsername, $LogDir)
$Account = New-Object System.Security.Principal.Ntaccount("$FTPUsername")
$Sid = $Account.Translate([System.Security.Principal.SecurityIdentifier])
$ACL = Get-Acl -Path "$LogDir"
$Permission = "$Account","Modify","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir"
} |