Powershell: slimmer output for start-transcript

Created on 29 Nov 2018  路  8Comments  路  Source: PowerShell/PowerShell

I'd like to see two options for start-transcript to reduce clutter and improve readability

-noheadermast (reduces or eliminates the first 15 or so lines that always appear)
-setprompt (to replace the default prompt that is captured) because you may not want to see
\server\directory\directory\directory\datetime long format here >

Area-Cmdlets-Core Issue-Enhancement Resolution-Fixed Up-for-Grabs

Most helpful comment

So I notice PowerShell transcripts also include a footer, e.g.

**********************
PowerShell transcript end
End time: 20181201203353
**********************

It would be odd to completely exclude the header and leave the footer in.

Headers and footers are useful to delimit multiple sessions in a single transcript.

Perhaps a -MinimalTranscriptHeader option, producing the following would be suitable.

**********************
PowerShell transcript start
Start time: 20181201203347
**********************

All 8 comments

I'd like to have a go at this.

Internally, the call that puts the header on the transcript is PSHostUserInterface.LogTranscriptHeader. So I'm leaning towards adding a -NoTranscriptHeader switch parameter to Start-Transcript, rather than -NoHeaderMast.

I haven't looked into your set prompt idea yet, but I'll see what I can find.

So I notice PowerShell transcripts also include a footer, e.g.

**********************
PowerShell transcript end
End time: 20181201203353
**********************

It would be odd to completely exclude the header and leave the footer in.

Headers and footers are useful to delimit multiple sessions in a single transcript.

Perhaps a -MinimalTranscriptHeader option, producing the following would be suitable.

**********************
PowerShell transcript start
Start time: 20181201203347
**********************

Thank you Jeremy.

-UseMinimalHeader is merged 馃帀 I'll have a look at -SetPrompt soon.

After some research, I'm not sure a -SetPrompt ... parameter is the right approach.

The prompt is the return value of the prompt function. Override that function to change the prompt, e.g. in your PS profile. You could handle all manner of scenarios by basing prompt's logic on environment variables.

Given that, I think Start-Transcript would be overstepping its boundaries by changing the prompt.

Can we call this issue closed?

I don't know whether the 'minimaltranscriptheader' you proposed was implemented. I didn't see any doc changes.
If you are asking me personally, please feel free to act as you see best. I'll submit as close and comment.

I'm sorry that wasn't clear!

The doc change references the pull request (PR), not this issue. So it didn't appear in the timeline here.

The name was changed to -UseMinimalHeader after some discussion on the PR.

-UseMinimalHeader and associated doc changes has been added to Powershell Core 6.2. I'm running 6.2 on a MacBook now and it's definitely there.

Was this page helpful?
0 / 5 - 0 ratings