title: Powershell Create Log file exception
body: <p>I currently running a script and where I can see the exceptions in the control panel. 
  For example </p>
  
  <pre><code>Exception calling "ExecuteNonQuery" with "0" argument(s): "Cannot drop the table 'testtabel', because it does not exist or you do not have permission."
  At line:383 char:36
  +         $insertData.ExecuteNonQuery &lt;&lt;&lt;&lt; ()
      + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : DotNetMethodException
  </code></pre>
  
  <p>This is no error in the script so the script moves on but I want to save these exception in a text file. I tried different methods like </p>
  
  <pre><code>$_ | Out-File C:\errors.txt -Append
  </code></pre>
  
  <p>or other log functions I had found on the Internet. </p>
  
  <p>Is there just an easy way to extract these exception to a text file?</p>