다음을 통해 공유


Retrieving MMS 2013 Content Sessions using PowerShell

In between my PowerShell activities, I’ll visiting the Microsoft Management Summit in Las Vegas next week. This week I’m delivering a PowerShell workshop in the Netherlands, and when returning from MMS I’ll again be teaching a PowerShell workshop before going to the PowerShell Summit in Redmond. So it’s going to be a busy month traveling to the US and back.

While preparing my PowerShell workshop this week I wanted to have a look at the sessions for MMS 2013 and went to the Sessions catalog on the www.2013mms.com website.

image

Because I could not find an option to export all sessions to a Excel sheet, I created a PowerShell script which retrieves all sessions and makes it possible to export the result to a csv file using the Export-CSV cmdlet.

If you want you can do many more fun things with the results, let me know what you created.

Remarks:

  • Retrieving the website and getting the HTML Tag name elements can take some time to finish, be patient!
  • You need PowerShell v3 to run this script.
 
#######################################################################################################################                        
# Description:   Get-MMS2013 Sessions. This script retrieves the sessions from the https://www.2013mms.com website
#                You need to have access to the website to retrieve the sessions. 
#                Example usage: Export all sessions to cvs file using the export-csv cmdlet.
#                Get-MMS2013Session.ps1 | export-csv -path c:\temp\mms2013sessions.csv -NoTypeInformation                
# Author:        Stefan Stranger (Microsoft)            
# Example usage: Run Get-MMS2013Session.ps1
# Disclamer:     This program source code is provided "AS IS" without warranty representation or condition of any kind
#                either express or implied, including but not limited to conditions or other terms of merchantability and/or
#                fitness for a particular purpose. The user assumes the entire risk as to the accuracy and the use of this
#                program code.
# Date:          04-02-2013                        
# Name:          Get-MMS2013Session.ps1            
# Version:       v1.000 - 04-02-2013 - Stefan Stranger - initial release
########################################################################################################################


$mms = Invoke-WebRequest -Uri "https://www.2013mms.com/Topic/List?format=html&Keyword=&Categories=&Timeslot=&Speaker=&Day=&Start=&Finish=&oc=&take=-1&skip=0&_=1364899913083"
$sessions = $mms.ParsedHtml.getElementsByTagName("div") | Where "classname" -match "^topic" | Select -ExpandProperty InnerText

foreach ($session in $sessions) {
    #$count++; $count; $session;
    $session = $session.split("`n",6);
    #Check Sessiontype.
    Switch -Wildcard ($session[0]) {
        '*-B*' {#Check for missing products
            if ($session[4] -like "Product(s)*"){
            $session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = $session[1]
                Track = $session[2]
                SessionType = $session[3]
                Product= $session[4]
                Description = $session[5]
            } #End pscustomobject
            } #end call
            } #end if
            else
            {
                $session | &{
                [pscustomobject]@{
                Session = $session[0]
                Speaker = $session[1]
                Track = $session[2]
                SessionType = $session[3]
                Product= ""
                Description = $session[4]
                } #End pscustomobject
                } #end call
            } #end else
        }
        '*-L*' {$session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = ""
                Track = $session[1]
                SessionType = $session[2]
                Product = ""
                Description = $session[3]
            } #End pscustomobject
            } #end call
        }
        '*-IL*' {$session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = ""
                Track = $session[1]
                SessionType = $session[2]
                Product = ""
                Description = $session[3]
            } #End pscustomobject
            } #end call
        }
        'BO*' {$session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = ""
                Track = ""
                SessionType = $session[1]
                Product = ""
                Description = $session[2]
            } #End pscustomobject
            } #end call
        }
        'EXM*' {$session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = $session[1]
                Track = ""
                SessionType = $session[2]
                Product = $session[3]
                Description = $session[4]
            } #End pscustomobject
            } #end call
        }
        'MMS*' {$session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = $session[1]
                Track = ""
                SessionType = $session[2]
                Product = ""
                Description = $session[3]
            } #End pscustomobject
            } #end call
        }
        'KEY*' {$session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = $session[1]
                Track = ""
                SessionType = $session[2]
                Product = ""
                Description = $session[3]
            } #End pscustomobject
            } #end call
        }
        'MSP*' {$session | &{
            [pscustomobject]@{
                Session = $session[0]
                Speaker = ""
                Track = ""
                SessionType = $session[1]
                Product = ""
                Description = $session[2]
            } #End pscustomobject
            } #end call
        }
        Default {#Write-Host "$($session[0]) session id not specified in script" -ForegroundColor Red;
                $session | &{
                    [pscustomobject]@{
                    Session = $session[0]
                    Speaker = $session[1]
                    Track = ""
                    SessionType = $session[2]
                    Product = ""
                    Description = "$($session[0]) session id not specified in script"
            } #End pscustomobject
            } #end cal
                    }

    }
}

image

 

image

Do you want to contact me during MMS or the PowerShell summit just send me a message on Twitter and who knows we can talk about Operations Manager or PowerShell or some other great topic!

Comments

  • Anonymous
    January 01, 2003
    On the PowerShell Magazine Website is also a post on how to retrieve the MMS Sessions using a RSS feed on the Channel 9 website. You can read more on the following website: www.powershellmagazine.com/.../channel-9s-mms-2013-rss-feed-is-more-fun-with-powershell /Stefan

  • Anonymous
    January 01, 2003
    Hi Rick, Did you check my other blogpost? blogs.technet.com/.../download-mms-2013-videos-from-channel-9.aspx Stefan

  • Anonymous
    January 01, 2003
    Dear Stefan, Thank you for the script. Could you please advise if PS script will download the PPT presentation as we well?

  • Anonymous
    April 04, 2013
    Cannot wait for the PowerShell script to download all MMS 2013 sessions in video and ppt when MMS 2013 is over :)

  • Anonymous
    April 10, 2013
    Hi Charoit, Right now not, but thinking about that too. Please be patient;-)

  • Anonymous
    April 10, 2013
    There are a few scripts out there that allows you to download the sessions using powershell.

  • Anonymous
    April 15, 2013
    Do you have a way to download just the HD videos for each session?