Blog on software engineering
How to redirect all output from a PowerShell script to a log file

How to redirect all output from a PowerShell script to a log file

 

 

The PowerShell script “My-Script.ps1” is just an example.

The *> will direct all output, including the output generated form scripts imported or executed from the “My-Script.ps1” itself.

 

.\My-Script.ps1 *> log.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.