How to put all result in 1 table

Welcome Forums General PowerShell Q&A How to put all result in 1 table

Viewing 2 reply threads
  • Author
    Posts
    • #285460
      Participant
      Topics: 12
      Replies: 12
      Points: 145
      Rank: Participant

      Hi.
      I am trying to put below result into 1 table.

      Below is the Code

    • #285469
      Participant
      Topics: 17
      Replies: 1957
      Points: 4,016
      Helping Hand
      Rank: Community Hero

      Format-Table is what is really breaking things. There is much easier ways to be build an object, take a look at this example:

      • #285547
        Participant
        Topics: 12
        Replies: 12
        Points: 145
        Rank: Participant

        Thanks Rob That works.
        One last question,

        How can I catch the error for this line of code. In case of the one of the server is offline.
        I would like to catch the error for that offline server while continuing the script for the rest of the server in the list.

    • #285640
      Participant
      Topics: 17
      Replies: 1957
      Points: 4,016
      Helping Hand
      Rank: Community Hero

      In order to catch errors for each server, you need to process them in a for loop rather than sending them as a batch. When you send a batch as a string array to a cmdlet, that cmdlet is processing them foreach($session in $ComputerName) {blah}, so you move it into your own loop to capture each failure. Recommend using a similar PSObject schema you can filter and find the failures and ensure that -ErrorAction stop is specified.

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