.comment-link {margin-left:.6em;}
A Collection of Random Thoughts
Saturday, July 01, 2006
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


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.

> so it *really* records everything

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
Pinging with 32 bytes of data:
*** snip ***
Reply from bytes=32 time<1ms TTL=128

Ping statistics for
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
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
** Footer snipped **
Post a Comment

Links to this post:

Create a Link

<< Home

Powered by Blogger