Hello Powershell.org. I have been searching google all day for an answer to this and I am just not getting what I need so hopefully somebody here can offer some assistance. The short explanation is that I have 2 arrays that each contain some duplicate info. See below
$ObjColl
Name TotalUsers TotalInbox
---- ---------- ----------
IT 3 3
Accounting 4 2
Marketing 2 1
What I actually want to do is aggregate the totals rather than doing a literal “combining” of the arrays. How can this be accomplished? Example of desired output below:
$Final
Name TotalUsers TotalInbox
---- ---------- ----------
IT 3 3
Accounting 6 3
Marketing 4 2
This is a very basic example of how you can create your own object with information from the properties of other objects. Let us know how you go with your scripting!
Thank you both for the prompt response. I tried the suggestion that KonfigurationKing suggested though I didn’t think it would work for me. I ended up changing the pscustomobject I had into a hashtable object, but still with duplicate values. I have yet to try Flynn’s suggestion, but in reading it I can see the concept and I think that is what I am looking for. I will let you know how it works for me, the help is much appreciated!
You have to account for duplicates. Array could contain one or more of the same therefore you group first to get the unique values and then do the math.
Thank you all for the prompt replies and the good ideas to try out! Dan Potter had the suggestion that worked the best for me. The Chart.png was a really fancy touch! You were missing the “start-process” cmdlet in front of it to make it auto launch, but I really like the presentation! I have pasted my full working code below in case anyone is interested, or finds this helpful. I am also open to constructive criticism, if anyone sees any better, more efficient ways to achieve the same results I am welcome to them!