Reading RSS Feeds–Even easier in PowerShell V3

by Doug Finke on September 22, 2011

in Microsoft,PowerShell,PowerShell V3,Windows 7,Windows 8

PowerShell V3 introduces Invoke-RestMethod, the CTP can be  found here. This simplifies working with XML returned from the Web, like RSS feeds.

Compare V3 to V2 below. V3 uses 50% fewer lines of code.

PowerShell V3

$url = ""            
Invoke-RestMethod $url | Select Title, Link

PowerShell V2

$url = ""            
$wc = New-Object net.webclient            
[xml]$xml = $wc.DownloadString($url)            
$ | Select Title, Link

The results are the same

# Results            
title                                                                            link                                                                           
-----                                                                            ----                                                                           
Cmdlet Help Editor is now released on CodePlex                         
Windows Management Framework 3.0 Community Technology Preview (CTP) #1 Availa...
8 Abstracts for the PowerShell Deep Dive in Frankfurt                  
Get-Help -Online Fails in German                                       
Extending Discounted Registration & Session Proposal Deadline          
PowerShell Deep Dive Registration Info & Call for Session Proposals    
PowerShell Deep Dive @ The Experts Conference Europe 2011              
Invoke-Expression considered harmful                                   
Download the Updated Core Help CHM                                     
PowerShell at TechEd 2011                                              
Keeping Help Helpful: Use -Online and Redirectable Links               
PowerShell Language now licensed under the Community Promise           
Using Get-WinEvent –FilterXml to process Windows Events              
Scaling and Queuing PowerShell Background Jobs                         
Only 2 days left to save $1000 on PowerShell Deep Dive registration    
More Deep Dive Info, Including Abstracts from the PowerShell Team      
Four more reasons to come to the PowerShell Deep Dive                  
A Few Deep Dive Abstracts                                              
Cmdlet Help Editor V2.0 with Module Support                            
Reminder: Register for the PowerShell Deep Dive Conference & submit your sess...
Does Your Hard Work Advance the Ecosystem?                             
PowerShell Deep Dive Conference                                        
Looking for your Feedback                                              
A very touching final goodbye                                          
Same Command. Different Return Types.                                  

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post:

You are forbidden!