4

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.

Rainer
  • 1,067
  • 2
  • 14
  • 29
  • Have a look at Start-Transcript: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-6 – TobyU Jul 23 '18 at 10:49

1 Answers1

7

Tee-Object is the function You are looking for.

Tomek
  • 641
  • 1
  • 6
  • 16