Highlighted
Expert
Expert

PowerShell to download VMworld 2014 sessions

Jump to solution

Damian Karlson created a great script to download the 2013 vmworld videos (including PowerCLI ones of course) with powershell.

Has anyone come up with a modified version for 2014 yet?

Here is the original posting

Automate All The VMworld US 2013 Session Downloads

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Highlighted
User Moderator
User Moderator

The captcha is not really an issue, I'm past that.

But when you get to the download pages, you stumble again on an application.

The times of simple URLs are gone I'm afraid :smileygrin:

For what it's worth, this will get you to the download page.

# Logon

$vmworld = 'http://www.vmworld.com/login.jspa'

$site = Invoke-WebRequest -Uri $vmworld -SessionVariable vmw

$logon = $site.Forms['loginform01']

$logon.Fields['username01'] = $user

$logon.Fields['password01'] = $pswd

$result1 = Invoke-WebRequest -Uri $vmworld -WebSession $vmw -Method Post -Body $logon.Fields

if($result1.StatusCode -eq 200){

    $vmworldSessions = 'http://www.vmworld.com/community/sessions/2014/'

    $sessions = Invoke-WebRequest -Uri $vmworldSessions -SessionVariable vmw

    $captchaExpr = $sessions.ParsedHtml.body.outerText |

        Select-String -Pattern "What is (?<Sum>[\d\s+]+)?" |

        Select -ExpandProperty Matches | %{$_.Groups["Sum"].Value}

    $captchaResult = Invoke-Expression $captchaExpr

    $sessionsForm = $sessions.Forms["Form"]

    $sessionsForm.Fields["input_firstName"] = $firstName

    $sessionsForm.Fields["input_lastName"] = $lastName

    $sessionsForm.Fields["email"] = $email

    $sessionsForm.Fields["BotBootInput"] = $captchaResult

    $result2 = Invoke-WebRequest -Uri $vmworldSessions -WebSession $vmw -Method Post -Body $sessionsForm.Fields

    if($result2.StatusCode -eq 200){

        $uri = "http://www.webcastregister2014.com/vmware/index.php"

        $body = "input_firstname=$firstName&input_lastName=$lastName&input_email=$email&post=post&submit=Submit"

        $result3 = Invoke-WebRequest -Uri $uri -WebSession $vmw -Method Post -Body $body

        if($result3.StatusCode -eq 200){

            $catalogUri = $result3.BaseResponse.ResponseUri.AbsoluteUri

            $result4 = Invoke-WebRequest -Uri $catalogUri -WebSession $vmw -Method Get

           

        }

    }

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
8 Replies
Highlighted
Contributor
Contributor

Anyone got any update on this.  I can't believe no one hasn't already created a script for this?

0 Kudos
Highlighted
VMware Employee
VMware Employee

Looks like they added a captcha code to the site now Smiley Sad

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
0 Kudos
Highlighted
Expert
Expert

Alan  thanks for your input:  we in the communities would like to  request  the following new cmdlet in powercli to commence development.

The syntax would work something like this:

get-vmworldsession -type powercli -captchabypass:$true

0 Kudos
Highlighted
VMware Employee
VMware Employee

Believe me, I looked, it wasnt a quick thing to do this, I couldnt find a way to scrape the maths captcha it gives you, then again I only spent about 5 mins on it.

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
0 Kudos
Highlighted
User Moderator
User Moderator

The captcha is not really an issue, I'm past that.

But when you get to the download pages, you stumble again on an application.

The times of simple URLs are gone I'm afraid :smileygrin:

For what it's worth, this will get you to the download page.

# Logon

$vmworld = 'http://www.vmworld.com/login.jspa'

$site = Invoke-WebRequest -Uri $vmworld -SessionVariable vmw

$logon = $site.Forms['loginform01']

$logon.Fields['username01'] = $user

$logon.Fields['password01'] = $pswd

$result1 = Invoke-WebRequest -Uri $vmworld -WebSession $vmw -Method Post -Body $logon.Fields

if($result1.StatusCode -eq 200){

    $vmworldSessions = 'http://www.vmworld.com/community/sessions/2014/'

    $sessions = Invoke-WebRequest -Uri $vmworldSessions -SessionVariable vmw

    $captchaExpr = $sessions.ParsedHtml.body.outerText |

        Select-String -Pattern "What is (?<Sum>[\d\s+]+)?" |

        Select -ExpandProperty Matches | %{$_.Groups["Sum"].Value}

    $captchaResult = Invoke-Expression $captchaExpr

    $sessionsForm = $sessions.Forms["Form"]

    $sessionsForm.Fields["input_firstName"] = $firstName

    $sessionsForm.Fields["input_lastName"] = $lastName

    $sessionsForm.Fields["email"] = $email

    $sessionsForm.Fields["BotBootInput"] = $captchaResult

    $result2 = Invoke-WebRequest -Uri $vmworldSessions -WebSession $vmw -Method Post -Body $sessionsForm.Fields

    if($result2.StatusCode -eq 200){

        $uri = "http://www.webcastregister2014.com/vmware/index.php"

        $body = "input_firstname=$firstName&input_lastName=$lastName&input_email=$email&post=post&submit=Submit"

        $result3 = Invoke-WebRequest -Uri $uri -WebSession $vmw -Method Post -Body $body

        if($result3.StatusCode -eq 200){

            $catalogUri = $result3.BaseResponse.ResponseUri.AbsoluteUri

            $result4 = Invoke-WebRequest -Uri $catalogUri -WebSession $vmw -Method Get

           

        }

    }

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
Highlighted
Expert
Expert

Luc,

Thanks very much for the contribution - I had one more idea.

how about this:

I log in manually through the browser and get myself to the page where I could download them through the browser. 

Then I open up Powershell - if I did it that way, would that overcome the obstacles to using powershell - assuming that I am already logged in?

0 Kudos
Highlighted
User Moderator
User Moderator

Tried that as well, but there is no logic for finding the download links.

And if one could find it, they seem to create the actual download link on the fly.

No, it's well protected against scripting this year :smileygrin:


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Highlighted
Expert
Expert

It appears the correct answer is it can't be done, which LucD determined - so thanks for trying.

0 Kudos