PowerShell, Atlanta Techstravaganza, and reading the PowerScripting.net RSS Feed with PowerShell

Today I had the pleasure of co-presenting “What’s new in Windows 8 PowerShell” (aka PowerShell v3) with my friend, Microsoft Regional Developer Evangelist Glen Gordon (blog | twitter).

You can find the slide deck for our presentation here.

We had a lot of code demos in the presentation, and some due to the short time period we didn’t get to. I’ll be posting the demos over the next few weeks, doing it slowly so as not to overwhelm anyone.

Below is the code to pull the RSS feed for the PowerScripting podcast. The code is pretty self explanatory, see the comments for more info.

#region Reading RSS Feeds

  # Reading RSS Feeds
    # Reading RSS Feeds has become even easier in v3
    $url = "http://feeds.feedburner.com/Powerscripting?format=xml"
    # v2 Syntax
    $webClient = New-Object net.webclient
    [xml]$rss = $webClient.DownloadString($url)
    $rss.rss.channel.item |
       Select-Object Title, pubDate, duration  |
    # v3 Syntax
    Invoke-RestMethod $url |
       Select-Object Title, pubDate, duration  |

    # To know the available object names, open the RSS
    # feed and look at the XML tags inside. The ones
    # shown in this example are pretty commong to most feeds.
#endregion Reading RSS Feeds