I have the following situation to which I cannot find a solution, but I think it must be very easy. I have the following variables:
$DataA - This variable contains the "Name" of specific AD Users, as well as columns "LastLogon" and "WhenCreated".
$DataB - This variable contains the "DisplayName" of specific Exchange users as well as columns "LastLogonTime" and "LastLoggedOnUserAccount".
$DataC - This variable contains only the names of the users that are present in both $DataA and $DataB under the column name "InputObject" as a result of the Compare-Object command.
The variable $DataA and $DataB contain information that I want to see in the $DataC or a new variable. In $DataC I have a list of names, and I want the corresponding attributes from $DataA and $DataB combined to a new variable. So for example:
$DataC contains a column with name "InputObject" and a value of "Test User".
$DataA contains a column with name "Name" and a value of "Test User, AND a column with "LastLogon" and a value of 2017-04-03 02:26.
$DataB contains a column with name "DisplayName" and a value of "Test User, AND a column with "LastLogonTime" and a value of 2017-04-03 02:26.
In a new $DataD variable I want to have those combined. Alternatively, it would also be good if it is possible to select-objects from other variables within a Compare-Object command. That's because $DataC is generated through Compare-Object, but I cannot seem to add columns with information from $DataA or $DataB. Hopefully you can help.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.