title: Remotely Grant server\localuser access to a folder by using PowerShell
body: <p>I have 100 servers where a local folder d:\backupmedia\ exists and every server has a local user as \backupuser , now I have to grant FullControl permission to this folder for this localuser using powershell. I tried following code which works fine for domain user but not for local user as I get following error,</p>
  
  <blockquote>
    <p>Exception calling "SetAccessRule" with "1" argument(s): "Some or all identity references could not >be translated."</p>
  </blockquote>
  
  <p>Code I tried,</p>
  
  <pre><code>foreach ($srvr in Get-Content .\Dev_Servers.txt) 
  {
  $AccountName="backupuser"
  $Right="FullControl"
  $Inheritperm="ContainerInherit, ObjectInherit"
  $Principal="$srvr\$AccountName"
  $Permission =$Principal,$Right,$Inheritperm,"None","Allow"
  $AccessRule=New-Object System.Security.AccessControl.FileSystemAccessRule($Permission)
  $UNCPath="\\$srvr\d$\backupmedia"
  $ACL = Get-Acl $UNCPath
  $ACL.SetAccessRule($AccessRule)
  Set-Acl $UNCPath -AclObject $ACL
  }
  </code></pre>
  
  <p>I found <a href="http://www.happysysadm.com/2012/09/how-to-remotely-modify-windows-acl.html" rel="nofollow">solution</a> to similar issue using fileacl utility but it seems it has been abondoned and no more available anywhere. </p>
  
  <p>Please help me to fix the issue.</p>