PowerShell, Scripting
comments 2

Download PowerScripting podcast episodes using PowerShell and BITS

Update (3/5): Fixed an issue with empty podcast enclosure links 

PowerScripting podcast series is a great source of PowerShell related information. I have been following the same since episode 80, if I remember that well. At present the site has no way to download all the episodes in one single click. So, this morning I wrote a quick script to download all of these episodes to my local archive using BITS file transfer service. It is a simple one and did not require lot of effort.  

 This snippet will download all podcast episodes (MP3) files using BITS file transfer service. You can monitor the progress using Get-BitsTransfer cmdlet. After testing this, I thought I will just put the whole thing in to a simple script so that I can re-use the same for other podcast feeds too. The result is the following PowerShell v2 script. 

[download id=”20″ format=”4″]   

Note: I have not tested this script with any feed URL other than PowerScripting podcast. At the same time, I don’t see a reason why this should fail if the feed URL is formatted similar to PowerScripting Feed URL. 

 This script is a bit more intelligent than the above code snippet. It can detect if proxy authentication is required and takes the feed URL as a parameter. After you dot source the script, 

Get-Podcast Output 

As you see in the output, Get-Podcast returns a custom object with three properties Title, PodcastURL and PodcastMedia. PodcastMedia property contains the link to MP3 file, PodcastURL is the episode page and Title is just title. To download all the episodes at once  

 Note: I have not tested this script with any feed URL other than PowerScripting podcast. At the same time, I don’t see a reason why this should fail if the feed URL is formatted similar to PowerScripting Feed URL. 

Get-Podcast can be a natural extension to BITS File transfer powerpack and that is what I did. I created another option in the Powerpack to download podcasts. This is what you see in the new release of powerpack. 

BITS PowerPack

BITS PowerPack

Over here, you can either open the episode web page or download the media using BITS. Once you start the download, all download jobs will appear in List of Active Jobs. Hope you find this useful.

Filed under: PowerShell, Scripting

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.