我目前有以下代码来设置文件夹的ACL权限。
$Acl = Get-Acl $TextBox2.text
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("domainname\$NameofgroupLCLM", "Modify", "ContainerInherit,ObjectInherit", "None", "Allow")
$Acl.SetAccessRule($Ar)
Set-Acl $TextBox2.text $Acl
$Textbox2.text
有文件夹的网络路径。我目前正在尝试将其设置为存储在变量$nameofgrouplclM
中的组,但是我收到错误:
Exception calling "SetAccessRule" with "1" argument(s): "Some or all identity references could not be translated." At line:177 char:2 + $Acl.SetAccessRule($Ar) + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : IdentityNotMappedException
如果我有" domainname \ groupexample"在没有变量的代码中它经历了罚款。我想知道如何在这段代码中使用变量?