Automate RSS Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

RSS ADO.NET Provider

Easy-to-use RSS client (consumer) enables developers to build .NET applications that easily consume RSS feeds.



Are you looking for a quick and easy way to access RSS feeds from PowerShell? We show how to use the Cmdlets for RSS and the CData ADO.NET Provider for RSS to connect to RSS feeds and synchronize, automate, download, and more.

The CData Cmdlets for RSS are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to RSS.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the RSS API, but also an SQL interface; this tutorial shows how to use both to retrieve RSS feeds. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for RSS. To access RSS feeds from other .NET applications, like LINQPad, use the CData ADO.NET Provider for RSS.

After obtaining the needed connection properties, accessing RSS feeds in PowerShell consists of three basic steps.

You can connect to RSS and Atom feeds, as well as feeds with custom extensions. To connect to a feed, set the URL property. You can also access secure feeds. A variety of authentication mechanisms are supported. See the help documentation for details.

PowerShell

  1. Install the module:

    Install-Module RSSCmdlets
  2. Connect:

    $rss = Connect-RSS -URI "$URI"
  3. Search for and retrieve data:

    $category = "US" $latest news = Select-RSS -Connection $rss -Table "Latest News" -Where "Category = `'$Category`'" $latest news

    You can also use the Invoke-RSS cmdlet to execute SQL commands:

    $latest news = Invoke-RSS -Connection $rss -Query 'SELECT * FROM Latest News WHERE Category = @Category' -Params @{'@Category'='US'}

ADO.NET

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for RSS\lib\System.Data.CData.RSS.dll")
  2. Connect to RSS:

    $conn= New-Object System.Data.CData.RSS.RSSConnection("URI=http://broadcastCorp/rss/;") $conn.Open()
  3. Instantiate the RSSDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Author, Pubdate from Latest News" $da= New-Object System.Data.CData.RSS.RSSDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.author $_.pubdate }