Rudi
Rudi

Reputation: 1169

powershell output to file AND console

I have a Powershell script running some hours. The execution shall be observed in a normal console window. Additionally (no redirect!) I would like to stream the output to a log file. Is there an easy way to do this during starting the *.ps1 script? All suggestions I found tell me how to redirect, but not both for the whole script.

Upvotes: 4

Views: 653

Answers (1)

Tomek
Tomek

Reputation: 671

Tee-Object is the function You are looking for.

Upvotes: 7

Related Questions