title: start-Transcript not capturing all output to log file..?
body: <p>I have the below code that goes through and gets scheduled tasks info and puts the output that occurs on the screen to a log file. </p>
  
  <p>However, what I have noticed is that all errors are logged EXCEPT for servers that have "Access is denied" - how can I log those errors in the log file as well. </p>
  
  <p>Below is the code:</p>
  
  <pre><code>Start-Transcript -path $scheduledpath\logging.txt -append
  
  foreach ($name in $names) 
  {
      Write-Host "Running Against Server $name" -ForegroundColor Magenta
      if ( Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue ) 
          {
              #$Command = "schtasks.exe /query /S $name /fo CSV /v &gt;c:\tools\Scheduled\$name.csv"
              $Command = "schtasks.exe /query /S $name /fo CSV /v &gt;$scheduledpath\$name.csv"
              Invoke-Expression $Command
              Clear-Variable Command -ErrorAction SilentlyContinue
          }
  
      else{
              Write-Host "$name is Down" -ForegroundColor Red
          }
  
  }
  
  Stop-Transcript
  </code></pre>
  
  <p>Here is the output on the screen:</p>
  
  <pre><code>&gt; Running Against Server SV064909 
  &gt; SV064909 is Down 
  &gt; Running Against Server SV081372 
  &gt; SV081372 is Down 
  &gt; Running Against Server YBEF008690_vorher_SV064930 
  &gt; YBEF008690_vorher_SV064930 is Down 
  &gt; Running Against Server Alt_SV064921 
  &gt; Alt_SV064921 is Down 
  &gt; Running Against Server SV073632 
  &gt; ERROR: Access is denied. 
  &gt; Running Against Server SV073633 
  &gt; ERROR: Access is denied.
  </code></pre>
  
  <p>Here is the output in the LOG file....no ACCESS IS DENIED Shown...?</p>
  
  <pre><code>&gt; Running Against Server SV064909 
  &gt; SV064909 is Down 
  &gt; Running Against Server SV081372 
  &gt; SV081372 is Down 
  &gt; Running Against Server YBEF008690_vorher_SV064930 
  &gt; YBEF008690_vorher_SV064930 is Down 
  &gt; Running Against Server Alt_SV064921 
  &gt; Alt_SV064921 is Down 
  &gt; Running Against Server SV073632 
  &gt; Running Against Server SV073633
  </code></pre>