I am trying to modify an NTFS permission to a folder located on a server. I only have access to the server through UNC and I have permissions to administer NTFS security.
I'm trying the following code:
$Pathv6 = '\MyHostname\folder'
$acl = Get-Acl $Pathv6
$acl.SetAccessRuleProtection($true,$false)
$ar = new-object System.Security.AccessControl.FileSystemAccessRule('Dominio\User01', 'Modify',"ContainerInherit, ObjectInherit","None","Allow")
$acl.AddAccessRule($ar)
set-acl -Path $Pathv6 -AclObject $acl
But when I try to execute it, I get the following error:
set-acl : No se pudieron convertir algunas o todas las referencias de identidad.
At C:\Datos\ArregloACL.ps1:37 char:5
+ set-acl -Path $Pathv6 -AclObject $acl
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (\MyHostname\...\Client.v6:String) [Set-Acl], IdentityNotMappedException
+ FullyQualifiedErrorId : System.Security.Principal.IdentityNotMappedException,Microsoft.PowerShell.Commands.SetAclCommand
As I read, it seems that it is not able to find the user, but it does exist and is well defined. If I try to do this operation manually, the permission is changed without problems. But I need to do it by script.
What can I do?