How to save all output to a file when running PowerShell ISE Script

Welcome Forums General PowerShell Q&A How to save all output to a file when running PowerShell ISE Script

Viewing 2 reply threads
  • Author
    Posts
    • #273936
      Participant
      Topics: 1
      Replies: 1
      Points: 15
      Rank: Member

      Dear Friends,

      I’m a newbie of PowerShell, my question is that I wanted to run below commands and have all the output generated by them to be saved into one single .txt file. I know that when it’s one command line we can use out-file or export-csv cmdlet, but how about there are more than one commands and all the output needs to be append together in one file?

       
      <p class=”qtext_para”>get-wmiobject win32_computersystem</p>
      <p class=”qtext_para”>Get-WmiObject -class win32_processor</p>
       

      Thank you very much!

    • #273939
      Participant
      Topics: 9
      Replies: 707
      Points: 2,842
      Helping Hand
      Rank: Community Hero

      Have you considered Start-Transcript and Stop-Transcript?

    • #273966
      Participant
      Topics: 1
      Replies: 1
      Points: 15
      Rank: Member

      Hi Doug,

       

      Thanks a lot! It works for me! I used:

      Start-Transcript “C:\transcript.txt”
      COMMANDLETS
      Stop-Transcript

       

      By the way, just wanted to know additionally – is it possible to output without the below information like transcript started and transcript end?

      **********************
      Windows PowerShell transcript end
      End time: 20201125153722
      **********************

Viewing 2 reply threads
  • You must be logged in to reply to this topic.