Reading RSS Feeds

by Apr 16, 2015

RSS feeds can be read by using an XML object, however XML objects do not support proxies.

Here is an example that uses Invoke-WebRequest to retrieve the RSS data via proxy (or directly if you omit the proxy parameters), then converts the results to XML.

#requires -Version 3


$url = 'http://blogs.msdn.com/b/powershell/rss.aspx'

$page = Invoke-WebRequest -Uri $url <#-Proxy 'http://proxy...:8080' -ProxyUseDefaultCredentials#>
$content = $page.Content


$xml = [XML]$content
$xml.rss.channel.item  | Out-GridView

The result is the PowerShell Team Blog RSS feed.

Twitter This Tip! ReTweet this Tip!