Outputting complete contents of a script

I want to be able to output the complete contents of a tracert to a card or table. The following code works but it just dumps the output to a card all in one long sentence. I dont understand what i would need to do to format it. I would basically want a line break at the end of each line? Does it have to output to a table? if so can someone point me in the right direction. Manipulating and rearranging the output is hard for me to grasp. Thanks in advance.

        New-UDRow {
       New-UDColumn -Id 'LeftColumn' -LargeSize 6 -Content {
            New-UDCard -Endpoint {
                New-UDInput -Title 'Please Enter Name of Server Name You Want To TraceRoute.' -Endpoint {
                param([String]$test)
                
            $Cache:cachetr = tracert $test
            Add-UDElement -ParentId 'RightColumn' -Content {
            New-UDCard -Title 'Results' -Content { $Cache:cachetr } 
            
            }#element
                  
            }#endpoint
              
            }#udcard
            }#column

       New-UDColumn -Id 'RightColumn' -LargeSize 6 -Content {
        }#column
    }#row

Try putting it in a pre tag.

           New-UDCard -Title 'Results' -Content { 
               New-UDElement -Tag pre -Content {
                     $Cache:cachetr 
              }
} 

It looks better but now its just one long line.

Try this:


    New-UDElement -Tag 'div' -Endpoint {
        $cachetr = (tracert www.google.com) -join '<br/>'
        New-UDCard -Title 'Results' -Content {
            New-UDHtml -Markup $cachetr
        }
    }

That works for me.

image

5 Likes

That did it. Thank you so much. what does the -join do?

Is there a way to show a progress bar while its running in the background?

1 Like