How to write only warnings to a text file from get command

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 6 years, 5 months ago.

  • Author
  • #6488

    by bubbabenz at 2012-10-19 12:40:40


    I would like to capture all the warnings returned from get-distributiongroup command to a text file.

    What is the syntax to do that?



    by DonJ at 2012-10-22 08:24:44

    It isn't that straightforward, unfortunately. PowerShell can natively only capture the output stream to a text file – to capture the Warning stream you'd need a custom host.

    In v3, it's possible to redirect the Warning stream into the Output stream, so that you can thus get the warnings using something like Out-File, but that'd mix the warnings in with the normal output. Unless you directed the normal output to a different pipeline, I suppose...

You must be logged in to reply to this topic.