VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

PowerShell to download VMworld 2014 sessions

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!

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
8 Replies
barry22ire
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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
Reply
0 Kudos
TheVMinator
Expert
Expert
Jump to solution

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

Reply
0 Kudos
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
TheVMinator
Expert
Expert
Jump to solution

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?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

TheVMinator
Expert
Expert
Jump to solution

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

Reply
0 Kudos