You must
have heard or read of using Start-Transcript and Stop Transcript to capture
your entire PowerShell session. But if you want to capture only the output and
error generated by a script, execute your scripts in below format.
PS> powershell.exe –noprofile –file c:\temp\Script.ps1
> C:\Temp\Log.txt
C:\Temp\Log.txt stores output of your
script and the errors generated. This is useful when executing scripts for
multiple computers.