I'm a bit late doing this, but I made my entry to the Scripting Games this morning and thought I'd share it.
Here are the rules for this month's puzzle:
Check out the original source for a better look at the formatting they're looking for on their output.
Here's my solution:
Some things I want to make note of here:
- The sample output that we were given to imitate was also a single line, meaning that the output they're looking for is flattened. I've done my best to imitate that by converting the output to a string, then replacing the literal linebreaks with three tab characters, which appears to be close to what they had; I also trimmed the start so that it wouldn't have extra space at the beginning, which wasn't shown in the sample output.
- If the intention was NOT to imitate the flattened string output (though I suspect it was), you can get that by removing everything from the last pipe character on, and the opening parentheses after the Param block.
- I used Param here, which means it will work fine if you just paste it on the command line and change the value of $Comp, or if you save it as a ps1 file and use -Comp to pass it the computer names you want to use.
I'm not going to go in to a great deal more detail on this one at this time, though I might come back later if I have the time.
For those who don't know about the Scripting Games and their new monthly format, check it out here: http://powershell.org/wp/the-scripting-games/