title: Having issue with Try Catch Finally script
body: <p>I am working on a try/catch/finally script to do some error reporting of files that don't exist. Yes, I am working on Log4j. This is what I have so far.</p>
  <pre><code>$fileList = Get-Content &quot;blah blah&quot;
      foreach ($file in $fileList)
  {
      try {
                  Get-Item $file
                  Set-ItemProperty $file -Name IsReadOnly -Value $false
                  zip -d $file org/apache/logging/log4j/core/lookup/JndiLookup.class
                  Set-ItemProperty $file -Name IsReadOnly -Value $true       
          }
      catch
          {
                  Write-Error &quot;$file not found.&quot;
          }
      finally
          {
                  $null = $errorreport
          }
  }
  $errorreport | Out-File &quot;blah blah.csv&quot;
  </code></pre>
  <p>For some reason, it puts jibberish into the output file and won't write the files into the csv that do not exist or the machine is not on. My guess is that it has something to do with the catch part but I can't figure it out.</p>
  <p>Any help with this would be appreciated as I am a newbie when it comes to try/catch/finally things.</p>
  <p>Thanks much!</p>