Author Posts

January 1, 2012 at 12:00 am

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

Hi,

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

What is the syntax to do that?

Thanks,

Steve

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...