$a and $b are lists with objects with two values I want to make one $ab list merged by the same name value This is my code
Import-Module PoshWSUS
Connect-PSWSUSServer -WsusServer localHost
$group = "All Computers"
#list of all computers name nad number of updates
$a = Get-PSWSUSUpdateSummaryPerClient | Select-Object "Computer","Needed"
#"Computer" is name value
#list of all computers name and ip
$b = Get-PSWSUSClientsInGroup -Name $group | Select-Object
"IPAddress","FullDomainName"
#"FullDomainName" is name value
$ab
#merging $a and $b by name value
return $ab
How can i do this as fast and easy as possible ?
There are a lot of specific questions and answers at StackOverflow on how to merge(/join) a list of of objects in PowerShell.
Unfortunately, there is no native cmdlet solution in PowerShell that can do this "as fast and easy as possible", but there are a few cmdlets available for download as e.g. the Join-Object cmdlet at the PowerShell Gallery that can join object lists simular to SQL.
The required command for your question when using the Join-Object cmdlet will probably as simple as:
$ab = $a | Join $b Name