title: "Access is denied" when changing a file's attributes
body: <p>I have a PS script that is trying to change the attributes (archive flag) of a file but I am receiving an access to path is denied error.</p>
  
  <p>The user I am logged on as is a member of the local Administrators group, and can change the attributes without a problem by right-clicking the file.</p>
  
  <p>The script is allowed to write these files to this folder in the first place, just not change their attribute.</p>
  
  <p>Does anyone know what other security setting I may need to change?  </p>
  
  <p>Thank you in advance.</p>
  
  <p>-Ben</p>
  
  <p>Edit - Code:</p>
  
  <pre><code>$file=get-item E:\Transfer\In\Data\EAS\BALSHEET.txt
  if(Test-Path $file){
      $file.attributes.GetType().Name
      $a = $file.attributes
      if($a -eq "Archive"){
          Copy-Item $file 'E:\FDM_Apps\Main\Inbox\_Data From Transfer'
          Copy-Item $file 'E:\Transfer\Archive\In Archive\Data\EAS'
          $ArchiveFile = get-item 'E:\Transfer\Archive\In Archive\Data\EAS\BALSHEET.txt'
          $ArchiveName = 'BALSHEET'+$date+'.txt'
          Rename-Item $ArchiveFile $ArchiveName
          $file.Attributes="Normal"   #Error occurs on this line
      }
  }
  </code></pre>