The Scripting Games are back :-D, excellent!
The puzzle of August is live at http://powershell.org/wp/2015/08/01/august-2015-scripting-games-puzzle/
First, you should copy/paste the URL proposed in the puzzle – http://www.telize.com/geoip – into a browser to see what it looks like.
We can see a pretty straight-forward reply formatted in JSON. Nice! This allows PowerShell versions as of 3.0 to use the built-in Invoke-WebRequest cmdlet to get the content of this webpage and the built-in *-Json cmdlets to convert the JSON content into a PowerShell object.
This also allows to solve the puzzle with a simple one-liner:
(iwr "http://www.telize.com/geoip").Content| ConvertFrom-Json|ft *tude,con*,t*
With all commands and parameter names spelled out:
(Invoke-WebRequest -URI "http://www.telize.com/geoip").Content| ConvertFrom-Json|Format-Table -Property *tude,con*,t*
That’s fairly easy if you have a recent version of PowerShell, isn’t it. Now, let’s think 2 minutes what you’d have done if you only had PowerShell version 2.0.
Fun? Ugly? Having a recent PowerShell version saves you a lot of time.
If you go to http://www.telize.com , you can read how to interact with the endpoint and that it offers a REST API, which means you can go down another route and use the built-in Invoke-RestMethod cmdlet.