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

Join Lists / Hashtables / Arrays with equal entrys

$
0
0

Hi together,

i have three datasets with Name/Value Pairs which have different priorities and i like to join them so that the highest priority wins.

For Example:

Dataset1 (Prio 1):
Name1=Mike
Name2=Peter
Name3=Chris

Datset2 (Prio 2):
Name2=Daniel

Dataset3 (Prio 3):
Name3=Dennis
Name4=Ben

These Datasets should join to a new Dataset like the following:

DatasetNew:
Name1=Mike (Dataset1)
Name2=Daniel (Dataset2)
Name3=Dennis (Dataset3)
Name4=Ben (Dataset3) 

What would be the best type of variable to store the data in and what can be the easiest way to compare and join?

If it is helpfull for anyone:

I read the Name / Value Pairs from WMI with the following code:

$collSettings = ''
$collSettings = Get-WmiObject -Namespace ('Root\SMS\Site_' + $siteCode) -ComputerName $sccmServer -Class SMS_CollectionSettings -Filter "CollectionID =  '$collID'"
$collSettings.Get()
$collVars = $collSettings.CollectionVariables

Thank you for any tips, tricks and considerations!


Viewing all articles
Browse latest Browse all 6937

Trending Articles