Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Join variables as if they were tables...

$
0
0

I am looking for a better way to join variable properties based on value. So far using measure-command, this is the most efficient way, but with over 2000 items in each array, it still takes around 3 minutes to process. Hoping there is another, quicker way to do this... 

# Joint $Resources, $OS, $LiveStatus on ResourceID into a single Variable/Table

$Resources = $Resources | Select Name, ResourceID,
           @{n="OS"; e={ $ID = $_.ResourceID; $OS | ? {$_.ResourceID -eq $ID} | % {$_.OperatingSystem}}},
           @{n="Status"; e={ $ID = $_.ResourceID; $LiveStatus | ? {$_.ResourceID -eq $ID} | % {$_.Status}}}
           @{n="Status"; e={ $ID = $_.ResourceID; $LiveStatus | ? {$_.ResourceID -eq $ID} | % {$_.StatusUpdateTime}}} 


Viewing all articles
Browse latest Browse all 6937

Trending Articles