PowerShell Diversion #3: PowerShell Week

Last week was “PowerShell Week” in our office*.  In an effort to introduce my colleagues to the wonders of PowerShell, I arranged a series of “PowerLunches”, each one lasting an hour and covering a different aspect of PowerShell scripting.   Enrolment was open to anyone in the office, and people were free to attend as many of the sessions as they wanted.

The week was a great success, but now I need to send a follow-up email.   I have to target it to just the attendees, so can’t just send an office-wide mail. The problem is that all I have are the separate attendee lists for each session (as CSV files), and, since attendance was more-or-less random, there is a lot of duplication between lists:

Attendee Lists

Can you use PowerShell to generate a single list of attendees and email addresses?  While making your list, consider these points:

  • The list must be in alphabetical order by surname
  • The list must account for everyone who attended at least one session, but should have no duplicate entries
  • Although there are no two people in my office with same name, make sure your code could handle a situation where two attendees did have the same name (but, of course, different email addresses)?

While you’re at it, can you work out who attended the most sessions, and who attended the fewest?

Some hints, if you need them.

* – If any of my colleagues are reading this, no, you didn’t miss out - last week wasn’t “PowerShell Week”. I made that up. Wouldn’t it be great, though?