• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How much of a session does start-transcript capture?

A

Andrew Watt [MVP]

#1
I did a simple test to see whether start-transcript could help with
the recently posted question about XCopy.

To my surprise,

start-transcript
XCopy C:\NonExistent.txt C:\NotHere.txt /C
stop-transcript

showed the error message from XCopy on the console but didn't capture
it in the transcript.

Since the Help file for start-transcript states that "the entire
session" will be copied to the transcript file that is a
disappointment and concern.

Is the failure to capture error information from XCopy "by design" or
a bug?

Thanks

Andrew Watt MVP
Author - Professional Windows PowerShell (Wrox)
 

My Computer

D

DBMwS

#2
I was able to see that even after redirecting error output to standard output
Here is the transcript file
**********************
Windows PowerShell Transcript Start
Start time: 20060522100203
Username : ..
Machine : ..
**********************
Transcript started, output file is ./test.txt
[^_^]PS[217]>XCopy C:\NonExistent.txt C:\NotHere.txt /C 2>&1
XCOPY.EXE : File not found - NonExistent.txt
At line:1 char:6
+ XCopy <<<< C:\NonExistent.txt C:\NotHere.txt /C 2>&1
[^_^]PS[218]>Stop-Transcript
**********************
Windows PowerShell Transcript End
End time: 20060522100235
**********************

But below is what i really typed.
[^_^]PS[216]>Start-Transcript ./test.txt
Transcript started, output file is ./test.txt
[^_^]PS[217]>XCopy C:\NonExistent.txt C:\NotHere.txt /C 2>&1
0 File(s) copied
XCOPY.EXE : File not found - NonExistent.txt
At line:1 char:6
+ XCopy <<<< C:\NonExistent.txt C:\NotHere.txt /C 2>&1
[^_^]PS[218]>Stop-Transcript
Transcript stopped, output file is C:\programming\ps\transcripts\test.txt
[^_^]PS[219]>ii test.txt


Apparently, "0 File(s) copied" is not displayed in transcript file "test.txt".


"Andrew Watt [MVP]" wrote:

> I did a simple test to see whether start-transcript could help with
> the recently posted question about XCopy.
>
> To my surprise,
>
> start-transcript
> XCopy C:\NonExistent.txt C:\NotHere.txt /C
> stop-transcript
>
> showed the error message from XCopy on the console but didn't capture
> it in the transcript.
>
> Since the Help file for start-transcript states that "the entire
> session" will be copied to the transcript file that is a
> disappointment and concern.
>
> Is the failure to capture error information from XCopy "by design" or
> a bug?
>
> Thanks
>
> Andrew Watt MVP
> Author - Professional Windows PowerShell (Wrox)
>
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)