While tinkering with PowerShell in the new build 9926 of Windows 10, I’ve investigating using Start-Transcript
more in my work. This is a great way of logging the inputs and outputs of PowerShell consoles. The cmdlet basically says what it does on the box - transcripts the whole console output.
In the new build of Windows, there’s an additional (as yet undocumented) switch parameter for this cmdlet: -IncludeInvocationHeader
.
If you append this switch when running Start-Transcript
, you’ll see the outputted text file differs ever so slightly. Before each entered command, the transcript function prepends a timestamp Command start time: yyyyMMddhhmmss
. This is a great method for always timing command execution should you wish to come back at a later stage and refer to its performance.
**********************
Command start time: 20150206080056
**********************
PS C:\test> gci
Directory: C:\test
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/02/2015 07:59 A
d----- 6/02/2015 07:59 B
d----- 6/02/2015 07:59 C
-a---- 6/02/2015 07:59 1147 1.txt
-a---- 6/02/2015 08:00 783 2.txt
Not a monumental change, by any standards, but it’s certainly a handy one the PowerShell team will (possibly, maybe, potentially, or possibly not) include in Windows 10 and the production release of Windows PowerShell 5!
Comments/questions
There's no commenting functionality here. If you'd like to comment, please either mention me (@[email protected]) on Mastodon or email me. I don't have any logging or analytics running on this website, so if you found something useful or interesting it would mean a lot to hear from you.