theme-sticky-logo-alt

The Ultimate Script to download Build Session Videos AND slides!

4 Comments

The Ultimate script to download Ignite sessions that I posted earlier this week was pretty popular, and some fellow community members asked for the same script for the Microsoft Build Conference earlier this year. That is why I created this PowerShell Script so everyone can easily download them whether they were present at Build or not! Here are the features:download Build Session Videos

  • Downloads all the Microsoft Build Conference Sessions and Slides
  • Groups them by folders
  • Makes sure no errors come up due to Illegal File names.
  • If you stop the script and restart in the middle, it will start where it left off and not from beginning

This is what it will look like at the end:

download Build Session Videos

*I will update total size of downloads in the following week!

Here is the script if you want to see the code, however my WordPress plugin breaks some PowerShell, so DO NOT copy it from my blog, instead download it from Technet galleries here

Make sure you send it out to all your twitter friends by clicking the image below!

Download the script from here!  Do not copy paste from below!

Here is the source code:

[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
# Grab the RSS feed for the MP4 downloads
# SharePoint Conference 2014 Videos
$a = ($rss.downloadstring("http://s.ch9.ms/events/build/2015/rss/mp4high"))
$b = ($rss.downloadstring("http://s.ch9.ms/events/build/2015/rss/slides")) 
#other qualities for the videos only. Choose the one you want!
# $a = ($rss.downloadstring("http://s.ch9.ms/events/build/2015/rss/mp4"))
#$a = ($rss.downloadstring("http://s.ch9.ms/events/build/2015/rss/mp3")) 
#Preferably enter something not too long to not have filename problems! cut and paste them afterwards
$downloadlocation = "C:\Build"
	if (-not (Test-Path $downloadlocation)) {
		Write-Host "Folder $fpath dosen't exist. Creating it..."
		New-Item $downloadlocation -type directory
	}
set-location $downloadlocation
#Download all the slides
try { 
$b.rss.channel.item | foreach{
	$code = $_.comments.split("/") | select -last 1	   
	# Grab the URL for the PPTX file
	$urlpptx = New-Object System.Uri($_.enclosure.url)
    $filepptx = $code + "-" + $_.creator + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
	$filepptx = $filepptx.substring(0, [System.Math]::Min(120, $filepptx.Length))
	$filepptx = $filepptx.trim()
	$filepptx = $filepptx + ".pptx"
	if ($code -ne "")
	{
		 $folder = $code + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
		 $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
		 $folder = $folder.trim()
	}
	else
	{
		$folder = "NoCodeSessions"
	}
	if (-not (Test-Path $folder)) {
		Write-Host "Folder $folder dosen't exist. Creating it..."
		New-Item $folder -type directory
	}
	# Make sure the PowerPoint file doesn't already exist
	if (!(test-path "$downloadlocation\$folder\$filepptx"))
	{
		# Echo out the  file that's being downloaded
		$filepptx
		$wc = (New-Object System.Net.WebClient)  
		# Download the MP4 file
		$wc.DownloadFile($urlpptx, "$downloadlocation\$filepptx")
		mv $filepptx $folder 
	}
	}
}
catch
{
Write-host "Slides are not yet up. Run this script every day to get the latest updates"
}
#download all the 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("<", "").Replace("|", "").Replace('"',"").Replace("*","")
	$file = $file.substring(0, [System.Math]::Min(120, $file.Length))
	$file = $file.trim()
	$file = $file + ".mp4"  
	if ($code -ne "")
	{
		 $folder = $code + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
		 $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
		 $folder = $folder.trim()
	}
	else
	{
		$folder = "NoCodeSessions"
	}
	if (-not (Test-Path $folder)) {
		Write-Host "Folder $folder) dosen't exist. Creating it..."
		New-Item $folder -type directory
	}
	# Make sure the MP4 file doesn't already exist
	if (!(test-path "$folder\$file"))
	{
		# Echo out the  file that's being downloaded
		$file
		$wc = (New-Object System.Net.WebClient)  
		# Download the MP4 file
		$wc.DownloadFile($url, "$downloadlocation\$file")
		mv $file $folder
	}
#text description from session
	$OutFile = New-Item -type file "$($downloadlocation)\$($Folder)\$($Code.trim()).txt" -Force
    $Category = "" ; $Content = ""
    $_.category | foreach {$Category += $_ + ","}
    $Content = $_.title.trim() + "`r`n" + $_.creator + "`r`n" + $_.summary.trim() + "`r`n" + "`r`n" + $Category.Substring(0,$Category.Length -1)
   add-content $OutFile $Content
	}

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page  on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  Also, don’t forget to check out SharePoint Community.Net for more great SharePoint Content.

Previous Post
The Ultimate Script to download Microsoft Ignite Videos AND slides!
Next Post
Review of CloudShare: cloud-computing platform for developing and testing IT applications, software, and systems.

4 Comments

  • May 10, 2015 at 12:40 am
    Dan

    Great script.. Would be great if it be filtered so only downloaded the SharePoint / O365 presentations, as I have no interest in System centre / Hardware / Exchange etc 🙂

    Reply
  • May 11, 2015 at 9:04 am
    Matt

    Easy way to filter based on the name is change line 26 to:

    $b.rss.channel.item | Where{($_.title -like “*SharePoint*”) -or ($_.title -like “*PowerShell*”)} | foreach{

    and change line 74 to:

    $a.rss.channel.item | Where{($_.title -like “*SharePoint*”) -or ($_.title -like “*PowerShell*”)} | foreach{

    Reply
    • May 11, 2015 at 7:52 pm

      Hey Matt,

      I was working already on a “filtering” solution, very similar to yours! Check out the updated script to see what I did!

      Reply

Leave a Reply

15 49.0138 8.38624 1 0 4000 1 https://vladtalkstech.com 300 1