PowerShell: reading PowerShell Transcript logs


I’ve started to use the start-transcript in my profile to keep a log of everything I do via the shell.

it’s becoming useful for looking back at what changes are made and when they were made. I’m also beginning to use it as the first steps of documentation. I’ve been commenting the things done in the shell for future reference.

The thing that is proving tricky is the formatting is that of a text doc and is not as easy to read as the shell (error, verbose and warning colours mainly).

I was wondering if anybody uses the Transcript functionality in this way and has a viewer of preference or a script that parses the log file to produce a doc of some sort?

Edit: i’m interested to know why the question has been down voted…


I believe it will be very hard to parse a transcript to create an accurate formatted document. You could however use the console host API to capture (parts of) the screen buffer.

This Windows Powershell blog article describes how this works.

A trivial way to use the (modified) script (Get-ConsoleAsHtml.ps1) is to modify your prompt function, so that all lines from the buffer that haven’t been written to your html transcript yet, are saved every time the prompt function is called. The first block of code is the contents of the modified script, the second block of code shows how you can use this script in your profile.

Example of a profile:


PowerShell: reading PowerShell Transcript logs by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply