Попытка добавить пользовательские разрешения в папку, но получаю ошибку - PullRequest
0 голосов
/ 05 декабря 2018

Это мой код:

$path = "\\Tanks\users\Derick\My Documents"
$AdAccount = 'domain\userDerick'
$Acl = Get-Acl ($path)
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule ("$AdAccount", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")
$acl.AddAccessRule($rule)

И вот ошибка, которую я получаю:

error:  Permissions.ps1  
Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity
references could not be translated."  
At C:\Users\Derick\Desktop\updaing Permissions.ps1:9 char:1  
+ $acl.AddAccessRule($rule)  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~  
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException  
    + FullyQualifiedErrorId : IdentityNotMappedException  

Что я могу сделать?

...