Jared on Tech

rss

Jared Shockley, Information Technology Professional This is my spot on the Internet for me to share my thoughts on technology, software, hardware, gadgets and IT in general. Please feel free to comment.


UPDATED! PowerShell and MS TechEd - Downloading the Videos

As many of you have seen that attended TechEd, a majority of the videos from TechEd are posted now to the MyTechEd site via Channel 9. In the past, there have been some great folks making scripts to download all of the videos and 2012 is no exception. The two that are the best at what they do are great in and of themselves. I decided to mash them up for myself and love the results.

To be clear, much of the work has been done by Stefan Roth from http://blog.scomfaq.ch/ and Tim Nilimaa from http://infoworks.tv/. These guys came up with great scripts and I believe I used Tim's from last year to download all of the 2011 content. In looking over their offerings, both offered some great features. All I did was cut and paste, changed variables, and tested it to ensure that it worked. So here's my overview of their code.

Stefan created his code to read the session information from a text file that included the file extensions in the text file. He also placed the download into a try-catch that allowed him to write out the "missing" files into an error log that could be used to re-run and catch missing files. His file transfer mechanism was the direct file transfer from the hosting server which made it so you had to close the PowerShell window.

Tim created his version 1.2 code to read the session information from a text file where the session title is listed without file extensions. This allows for flexibility of downloading any file named properly with the session title based on the file extension, .wmv for videos and .pptx for PowerPoint decks. He also showed the status of all downloads based on the sessions in the file and the current file download while using an Async file transfer. This made cancellation via CTRL-C very easy.

What I did was took the Async file transfer and status system of Tim’s code and added it to Stefan's code with the try-catch. I also did some clean-up of a few things and made the pathing work for what I wanted, basically having the code drop the videos into a \Videos\ folder from where I direct the path to. If you want to download the PowerPoint files, just change the .wmv in the sessions file to .pptx and it should get the ones posted. I am looking to make a revision to the code to add in a variable that will say to download WMV, PPTX, or both files but that is not in here yet.

Download a .Zip file containing the PS1 and the sessions.txt file here.

I want to thank Stefan and Tim for allowing me to post this. Make sure to visit them at:

They have great information on their blogs about their PowerShell and much more. Check them out!

Jared

Updated: 6/21/2012 - 3:00 pm PT

I received a tweet from Brad Huffman (@bradhuffman). He stepped up and made some of the things I was planning to look at this weekend. Great job by Brad and I want to point people to his blog post at:

http://bradhuffman.com/wordpress/2012/06/21/teched-downloader-mashup-powershell-script/

This sort of community work is what community in the IT Professional world means. Great job again Brad!




Comments are closed.
Showing 3 Comments
Avatar  Brad 6 years ago

When running script from PS command line, the DownloadFileAsync method never seems to start. I get errors that file doesn't exist as it tries to check progress. If I run the script by right clicking and choosing to Run With PowerShell script runs like a champ. Any ideas?

Nevermind. Just had a thought, and figured it out. I was using "." as a relative path. It's odd that it worked running it one way but not the other.

Avatar  Jared Shockley 6 years ago

@sql_jay - I will have to give that look. Thanks for the information!

Avatar  sql_jay 6 years ago

I have a script from sqlvariant.com to download the MSM Sql Server videos. It has some code to check if you already have the file(s) you are trying to download. It would be a great addition to your compliation script. Here is where to find it: http://sqlvariant.com/2010/12/powershell-script-to-download-sql-mcm-videos/