The details of the event scenario and the design points for Beginner Event #4 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog.
The key to this one is figuring out how to format the output as shown in the screen shot in the event scenario which is similar to the one in the image below:
The PowerShell Down Under guys posted some great prep videos leading up to the beginning of the scripting games and one of them titled Scripting Games 2012 - Working with Folders gives you a head start on solving this one. I found out about these video’s by following other PowerShell enthusiast on Twitter. If you’ve read Don Jones’s book titled Learn Windows PowerShell in a Month of Lunches, he also helps prepare you for this one. The one exception is using the -Passthru parameter to format the output properly. I hadn’t previously seen any references to this parameter being used with the Compare-Object cmdlet but I had seen it used with other cmdlets. Getting the help information on Compare-Object showed this parameter existed and trial & error confirmed that it formated the output properly.
Here’s the one liner that I submitted to the PowerShell Code Repository site:
Compare-Object -ReferenceObject (Get-ChildItem 'c:\2') -DifferenceObject (Get-ChildItem 'c:\1') -Property Name -PassThru