I'm wondering how to work with nested Forach-Object, Where-Object and other Cmdlets in Powershell. For example this code:
$obj1 | Foreach-Object {
$obj2 | Where-Object { $_ .... }
}
So in the code block of Foreach-Object I use the elements of $obj1 as $_. But the same happenn in the code block of Where-Object with $obj2. So how can I access both objects elements in the Where-Object code block? I would have to do $_.Arg1 -eq $_.Arg1 but this makes no sense.