I am trying to write the entire output (errors included) of an executing script to the console and a file at the same time. I have tried several different options:
By default only the Success stream of data is passed on to the Output file. To direct errors and warnings you will have to add something like this :
your script 3>&1 2>&1 | Out-file log.txt