You may find it useful at times to record the output of your shell sessions in a log file. This can help you save the history of all the commands you've executed and determine the success or failure of automated scripts. In this recipe, you'll learn how to create a PowerShell transcript. An example of when this could be useful is if we are developing a script and about to implement it in a production environment. It would be neat to use transcript logging during the first run(s).
Logging shell sessions to a transcript
How to do it...
- To create a transcript, execute the Start-Transcript cmdlet:
Start-Transcript c:\logfile.txt
- You can stop recording the session using the Stop-Transcript cmdlet:
Stop...