title: Compress-Archive command returns "Exception: Stream was too long."
body: <p>I have a simple script here to archive logs that begin with the name "Archive" then delete those files leaving only the archive.</p>
  
  <pre><code>cd L:\
  
  $Source =  Get-ChildItem L:\ | Where{$_.Name -match "^Archive.*\.evtx$"} |Get-ChildItem -name
  
  $CurrentDate = get-date -Format M.d.yyyy
  
  $Destination = "$CurrentDate.zip"
  
  Compress-Archive -Path $Source -destinationpath $Destination
  
  rm L:\$Source
  </code></pre>
  
  <p>However, I receive the below error when the script runs:</p>
  
  <blockquote>
    <p>Exception calling "Write" with "3" argument(s): "Stream was too long." At
    C:\windows\system32\windowspowershell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:809
    char:29<br>
    + ...                     $destStream.Write($buffer, 0, $numberOfBytesRead)<br>
    +                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException<br>
        + FullyQualifiedErrorId : IOException</p>
  </blockquote>
  
  <p>Any suggestions?</p>