MSH/Powershell Followup
Yesterday, I posted about the History command, or more accurately, how I felt it was a bit lacking in how it functioned.
Since then, I've received 2 suggestions for enhancing the history (or get-history) command.
The first suggestion came from Ross Smith IV on the Exchange team. He indicated that you can record your entire shell session simply by entering the command
Start-transcript
This will literally record every action that takes place within your command shell. The only downside (if there is one) is that it is very verbose, so it *really* records everything. The information is recorded to a text file in your My Documents folder by default. Recording ends automatically when the MSH session is exited, or by typing Stop-transcript.
The second suggestion comes from Jeffrey Snover, who is part of the Windows Powershell Team. He left a comment on the original post, but I thought I'd include it here as well. He blogged about a way to preserve history across sessions.http://blogs.msdn.com/powershell/archive/2006/07/01/653194.aspx
Thanks for both of these suggestions. While they are quite different, both are great options.
I am afraid to say that it doesn't "really records everything" though.
If you start a transcript and then run a built-in windows commands such as "ping",
the result won't be written on the transcript file
#==============================#
[^_^]PS[27]>Start-Transcript .\error.txt
Transcript started, output file is .\error.txt
[^_^]PS[28]>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
*** snip ***
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
[^_^]PS[29]>Stop-Transcript
Transcript stopped, output file is C:\programming\ps\test\error.txt
[^_^]PS[30]>type error.txt
#==============================#
If you look at the content of "error.txt", you won't see the "output" of ping command
#==============================#
** Header snipped **
Transcript started, output file is .\error.txt
[^_^]PS[28]>ping 127.0.0.1
[^_^]PS[29]>Stop-Transcript
** Footer snipped **
#==============================#
<< Home