Need a solution to view output of a script

This topic contains 4 replies, has 2 voices, and was last updated by Profile photo of Daniel Krebs Daniel Krebs 1 year, 11 months ago.

  • Author
    Posts
  • #23943
    Profile photo of Daniel Demers
    Daniel Demers
    Participant

    We use a program called Kaseya. It allows us to launch remote commands/scripts on computers, BUT getting the output of the commands is not straight forward. What I mean is, it should be storing the output of a script to a text file, but this is not always the case.

    I came across tee-object, this could work, BUT in version 2 (and we have a lot of XP Machines still) tee doesn't have the -Append feature.

    I am looking for a method to capture all the write-warning/host commands and to capture any of the errors that occur... basically I want everything in the console to be in a file. Can someone provide some suggestions please.

  • #23944
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    Checkout the Start-Transcript cmdlet. Add it to your scripts at the beginning to capture all output including verbose messages into a file.

    https://technet.microsoft.com/en-us/library/hh849687(v=wps.620).aspx

    Start-Transcript -Path C:\Logs\MyScript.log
    
  • #23945
    Profile photo of Daniel Demers
    Daniel Demers
    Participant

    Start-Transcript : This host does not support transcription.

    The issue with this is that it doesn't support Powershell Version 2 and we have a lot of windows XP machine out there.

    my one big issue with Powershell is how Microsoft doesn't make more of an effort to have it supported on its legacy programs. What I mean by this is Windows XP is still used a lot and powershell v3-4-5 should be easier to get on machines (i.e. windows update/optional update). .

  • #23947
    Profile photo of Daniel Demers
    Daniel Demers
    Participant

    Sorry, I was mistaken!. The transcript doesn't work from the ISE and I must have read an incorrect article about transcript not being a function until Version3.

    Start-transcript is exactly what I want.

  • #23951
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    Great. Sorry I forgot to mention that transcription does not work in the ISE until v5.0. Version 5.0 introduces transcription support for the ISE.

You must be logged in to reply to this topic.