Powershell and combining different object arrays
Posted on 2014-03-05
I wish to create a script whereby it does 3 core tasks
1- $getapplicationevents = get-eventlog -logname application
2- $getsystemevents = get-eventlog -logname system
3- $errorlogs = import-csv "c:\logs\logs.csv"
At this point i wish to combine certain member properties of each of the previous objects into a new "master object" with the goal of inserting into a database table or export to csv. All of the 3 objects would have a similar property the "host's name" . This would be similar concept to a primary key
My question is around the combining of certain member properties ;
Using $masterobject as the target for combining, with $getapplicationevents.message, $getsystemevents.message and $errorlogs.message in one array of objects ,$masterobject .The understanding is i would need to create the $masterobject and then use the add-member command but unsure of the structure from here ..