我正在尝试将 ACL 设置为仅修改,但是当我运行它运行的代码时,但指定用户的权限仍然为空,我哪里出错了?
$ApplicationPoolIdentity = "domain\username"
function SetACL()
{
param (
[Parameter(Mandatory=$true)]
[string] $Path
)
$Acl = Get-Acl $Path
Write-Host "Path:" $Path "ID:" $ApplicationPoolIdentity
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule($ApplicationPoolIdentity,"Write","Allow")
$Acl.SetAccessRule($Ar)
Write-Host $Acl
$Acl | Set-Acl $Path
}
SetACL "F:\Test123\"