title: PowerShell redirect write-warning to write-output
body: <p>I'm refering to the PowerShell script located here: <a href="http://support.microsoft.com/kb/2962486/en-us" rel="nofollow">http://support.microsoft.com/kb/2962486/en-us</a></p>
  
  <p>I'd like to redirect the output of write-warning to write-output for this particular piece of code:</p>
  
  <pre><code>    #Check if the computer has any local user accounts whose passwords are not going to be rolled by this script
      foreach ($User in $LocalUsers)
      {
          if ($LocalAccounts -inotcontains $User)
          {
              Write-Warning "Server: '$($TargettedServerName)' has a local account '$($User)' whos password is NOT being changed by this script"
          }
      }
  </code></pre>
  
  <p>The reason is that default redirection not seems to redirect Write-Warning to file, from what i read it is intended to print to console only. So applying *> or *>&amp;1 only captures StdOut and StdErr in case of this script.</p>
  
  <p><a href="https://technet.microsoft.com/en-us/library/hh847746.aspx" rel="nofollow">https://technet.microsoft.com/en-us/library/hh847746.aspx</a></p>
  
  <p>Is there any other way of redirecting Write-Warning output to file?</p>
  
  <p>Thanks in advance.</p>