none
Start-Transcript and Powershell Logging RRS feed

  • Question

  • Hi Everyone,

    I've been tasked to enable logging as max as possible in the powershell scripts I write for Remoting and sometimes for many users at once.

    We want to log everything which a powershell script is doing with the exact time it is done.

    > Any urls that can help me learn specifically more on logging everything that my powershell script does ?

    > Start-Transcript when run directly from a powershell captures the output + the actual command as well in the notepad. However when run as a ps1 script, it does not capture the actual command which was run but only the output and errors, is this by design?

    >I have been using measure-command and a few functions to capture how much time my scripts take to re-write a better code, any urls to learn optimizing the scripts and to be able to measure them in terms of speed, performance and execution etc ?

    Kindly advise.


    GD



    • Edited by Gudakesh (GD) Friday, June 29, 2018 2:48 PM
    • Moved by Bill_Stewart Tuesday, July 31, 2018 3:19 PM Unanswerable drive-by question
    Friday, June 29, 2018 2:44 PM

All replies

  • Add the switch '-IncludeInvocationHeader' to the start-transcript command to capture more information about the executed commands in the transcript.
    Sunday, September 29, 2019 6:40 PM
  • Add the switch '-IncludeInvocationHeader' to the start-transcript command to capture more information about the executed commands in the transcript.
    Does the '-IncludeInvocationHeader' switch provide the information that you wish to capture in the transcript?
    Tuesday, July 21, 2020 5:46 AM