I am using two PSObjects lets call them $job1 and $job2 that contain some identical Property Names. The properties for $job1 has the values but the matching properties for $job2 does not.I need to be able to do a foreach loop where if property name in $job1 matches $job2 property name, update Property value of $job2 based on the Property Name.
I was playing around with the below code but I cannot get it to update the Property values of $job2.
$job1.PSObject.Properties | %{if($_.Name -in $job2.PSObject.Properties.Name){[$_.Value = $job2.PSObject.Properties.Value}}
Thanks in advance for all the help!!