Author Posts

January 19, 2016 at 10:19 am

I have to function that return results in the same format. How do I join them to 1 table

$bsparta = bing-sparta -content $path | ConvertTo-Html -Fragment 
$bhaledon = bing-haledon -content $path  | ConvertTo-Html -Fragment

PS C:\> $bsparta 

Location                                     Distance In Miles                            Traffic Status                               Eta with Traffic                            
--------                                     -----------------                            --------------                               ----------------                            
Sparta                                       1 Miles                                      None                                         1 Minutes                                   



PS C:\> $bhaledon 

Location                                     Distance In Miles                            Traffic Status                               Eta with Traffic                            
--------                                     -----------------                            --------------                               ----------------                            
Haledon                                      52 Miles                                     Mild                                         68 Minutes                                  

January 19, 2016 at 10:21 am

Since these objects all have the same set of properties, you just need to use a single pipe to ConvertTo-Html. For example:

$bsparta = bing-sparta -content $path
$bhaledon = bing-haledon -content $path

$table = $bsparta,$bhaledon | ConvertTo-Html -Fragment

January 19, 2016 at 10:23 am

Awesome thanks Dave!