Have you tried:
.\MyScript.ps1 2>&1 | tee -filePath c:\results.txt
2>&1
is what you’re looking for
Note: This answer works great in PowerShell 1.0 and 2.0, but will capture ONLY standard output and errors in PowerShell 3.0 and later.
Have you tried:
.\MyScript.ps1 2>&1 | tee -filePath c:\results.txt
2>&1
is what you’re looking for
Note: This answer works great in PowerShell 1.0 and 2.0, but will capture ONLY standard output and errors in PowerShell 3.0 and later.