This is my code so far:
$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)
And this is the error I get:
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
What can I do?