A co-worker of mine put up this blog entry today, I like it. I too have closed the PowerShell window before I really wanted to. I use the F7 key, and the up/down arrows, but there is nothing like a literal log, especially when it comes to working up specific elements of a complex (or even brute force) script. My thanks to Mr. Jaworski to putting this together – his technique works on every PS install I have tried it on (so far ).
I modified the instructions Scott lays out, because I don’t like having an unlimited growth file. I also did not see the point, however well taken, to some of the preliminary setup. So, I distilled down to one line:
start-transcript "c:\PS log $(get-date -f "yyyy-MM-dd HHmm").txt”
This simple one liner gets you this:
The resulting file looks like this:
Note that the date/time format is in something *I* like, so you might want to change that around a tad. But all the nice details are there.
Of course, you will need to “stop-transcript” when you get done.