到目前为止,这是我的代码:
$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
我该怎么办?