到目前为止,这是我的代码:
$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)
这是我得到的错误:
错误:权限.ps1
使用“1”参数调用“AddAccessRule”的异常:“部分或全部身份
无法翻译参考文献。”
在 C:\Users\Derick\Desktop\updaing Permissions.ps1:9 char:1
+ $acl.AddAccessRule($rule)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IdentityNotMappedException
我能做些什么?