Powershell ACL未设置

时间:2013-08-02 09:52:11

标签: powershell acl

我正在尝试将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\"

0 个答案:

没有答案