[UPDATE]Unfortunately my first version didn’t work as expected due to the fact that the RSS only holds 20 posts. So I had to rewrite the script a bit to enumerate all sessions instead.

I took a couple of minutes to write a script to download all slidedecks from Ignite 2016, perfect for having on the flight back home.

Just create a folder C:\Ignite2016Slidedecks save the PowerShell script, execute it and wait.

The content looks like this and further down there is a link for downloading the ps1 file.

 

#########################################################################################
#   This Sample Code is provided for the purpose of illustration only and is not
#   intended to be used in a production environment.
#
#   WARNING:
#   YOU SHOULD NEVER RUN A SCRIPT IN PRODUCTION IF YOU AREN’T 100% CERTAIN OF WHAT IT
#   WILL DO.  ALL SCRIPTS SHOULD BE THOROUGHLY UNDERSTOOD AND TESTED IN A NON-PRODUCTION
#   ENVIRONMENT PRIOR TO BEING USED IN PRODUCTION.  THIS HELPS ENSURE THAT PRODUCTION
#   PROBLEMS DO NOT OCCUR AS A RESULT OF RUNNING SCRIPTS THAT HAVE NOT BEEN TESTED AND
#   VALIDATED BEFOREHAND.
#
#   THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED “AS IS” WITHOUT WARRANTY
#   OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
#   WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
#########################################################################################
<#
.Synopsis
Script for download all Ignite 2016 slidedecks from the https://techcommuity.microsoft.com
Change the variable $Ignite2016ContentTarget to change target folder
.DESCRIPTION
This script will download all the Ignite 2016 slidedecks that are available from Techcommunity via the OneDrive URL on the session page
In the future there may be a version downloading the videos from YouTube as well, until then watch them online from this URL
https://www.youtube.com/channel/UCrhJmfAGQ5K81XQ8_od1iTg
.AUTHOR
Mattias Fors http://deploywindows.info
.VERSION
1.0  30 sept 2016, Mattias
2.0  1 oct 2016, Mattias
.EXAMPLE
.\DownloadIgnite2016Slidedecksv2.ps1
#>
Add-Type -AssemblyName System.Web
$Ignite2016ContentTarget = “$($env:SystemDrive)\Ignite2016Slidedecks\”
# A quick research found no content over 1450
$Ignite2016ContentRssMaxNumber = 1450
$Ignite2016ContentRss = “https://techcommunity.microsoft.com/gxcuf89792/rss/message?board.id=MicrosoftIgniteContent&message.id=&#8221;
#Create the local Ignite 2016 content path if not exists
if ( (Test-Path $Ignite2016ContentTarget) -eq $false )
{
New-Item -Path $Ignite2016ContentTarget -ItemType Directory | Out-Null
}
for ($i = 1; $i -lt $Ignite2016ContentRssMaxNumber; $i++)
{
$IgniteMessage = Invoke-WebRequest -Uri “$($Ignite2016ContentRss)$i”
    #If the RSS feed is successfully received go on
if ( $IgniteMessage.StatusCode -eq 200)
{
$RssXmlItems = ([xml]$IgniteMessage.content).selectnodes(“/rss/channel/item”)
foreach ( $item in $RssXmlItems )
{
if ($item.title -notlike “Re:*”)
{
Write-Output “Looking for content in $($item.title)…”
#Write-Output “$($item.link)”
$ItemContent = Invoke-WebRequest -Uri “$($item.link)”
#Continue if the URL successfully recieved
if ($ItemContent.StatusCode -eq 200)
{
foreach ( $ItemElement in $ItemContent.AllElements )
{
if ($ItemElement.tagName -eq “IFRAME”)
{
if ( ($ItemElement.src -ne “f”) -and ($ItemElement.src -ne $null))
{
switch ($ItemElement.src)
{
{$_ -like ‘*www.youtube.com*’ } {
write-host “YouTube Video, do not download.”
}
{$_ -like ‘*onedrive.live.com*’ } {
Write-Host “OneDrive content found, starting download…”;
$OneDriveContent = [System.Web.HttpUtility]::HtmlDecode(($ItemElement.src).toString().Replace(“embed”,”download.aspx”));
#Write-Host $OneDriveContent;
$fileName = (“$($Item.title).pptx”).Replace(“:”,”-“).Replace(“‘”,””)
if (Test-Path -Path “$($Ignite2016ContentTarget)$($fileName)”)
{
Write-Host “File already exists, skipping. $($fileName)” -ForegroundColor Yellow
} else {
Invoke-WebRequest -Uri $OneDriveContent -OutFile “$($Ignite2016ContentTarget)$($fileName)”
}
}
Default {
Write-Host “Unknown content $($ItemElement.src)” -ForegroundColor Red
}
}
}
}
$ItemElement = $null
}
}
}
}
}
}

 

And here is the download link for the Powershell script, version 2

DownloadIgnite2016Slidedecksv2.ps1

If you would like to customimze the script to only download certain sessions, experiment with this line

if ($item.title -notlike “Re:*”)

it could for example

if (($item.title -notlike “Re:*”) -and ($item.title -notlike “BRK*”))

or why not just include one type of sessions

if ($item.title -like “BRK*”)

 

Happy to hear some feedback in the comments and please share it

Advertisements