Tuesday, March 11, 2014

Download all SharePoint 2014 Conference Videos Powershell Script.

If you missed SPC2014 you can still download all of the session videos using this PowerShell script I lightly modified (just changed the path) from Vlad Catrinescu's script for SPC2012 that he adapted from Todd Klindt's script for Tech-Ed 2012.  :)  Both of which can be accessed here.

Now, here is the code (just copy, paste, and save as a .ps1):

[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)

# Grab the RSS feed for the MP4 downloads

# SharePoint Conference 2012 Videos
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/SharePoint-Conference/2014/RSS/mp4"))

# Walk through each item in the feed
$a.rss.channel.item | foreach{  
    $code = $_.comments.split("/") | select -last 1      
    # Grab the URL for the MP4 file
    $url = New-Object System.Uri($_.enclosure.url) 
    # Create the local file name for the MP4 download
    $file = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".mp4" 
    # Make sure the MP4 file doesn't already exist
    if (!(test-path $file))    
        # Echo out the  file that's being downloaded
        $wc = (New-Object System.Net.WebClient) 

        # Download the MP4 file
        $wc.DownloadFile($url, $file)