Weekend Scripter: Use PowerShell to Connect to GoToMeeting


Summary: Use Windows PowerShell to provide a GUI input and build a custom URL for Internet Explorer.

Honorary Scripting Guy, Sean Kearney, here to share a little fun that I have enjoyed on the client site. I say it was fun because, to be quite honest, the problem really wasn't that challenging, but to make the solution seamless to an end user was.

Our challenge is to try to get a computer to connect to GoToMeeting without installing the client software.

The problem was that the application would try to force a user through a complete download of the client application, then attempt an installation. Only after this process would you see a friendly window indicating, "Hey, you could click here to run a version that totally doesn't need local Admin rights, dude!"

To be honest, it didn't say that, but it did take a while before the screen prompted me with an alternate method of connecting.

What it finally presented was a URL that allowed a manual method of connecting to the system with a Flash-based version of the software. The URL looked something like this:

https://www1.gotomeeting.com/join/123123123?clientType=flash

This would launch a GoToMeeting with the ID # of 123123123.

The answer was really quite simple:

  • Prompt the user for the meeting ID number.
  • Build the URL with the meeting ID included.
  • Launch Internet Explorer with the supplied URL.

To prompt for the meeting ID number, we could get away with using Read-Host:

$MeetingID=READ-HOST 'Enter GotoMeeting ID #'

But I wanted this to be usable by normal users. I wanted a simple GUI popup for this.

With a little digging on the Internet, I found a simple routine to provide a popup box by using Visual Basic:

[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null

$MeetingID = [Microsoft.VisualBasic.Interaction]::InputBox("GotoMeeting Flash", "GotoMeeting ID")

This would provide a simple text box on the screen that looks like this:

Image of text box

However, in some cases, the meeting ID for GoToMeeting is presented in email in the following format:

000-000-000

To ensure that users could copy and paste the number into the meeting box, we can leverage a method to replace any hyphens ( - ) found with nothing:

$MeetingID=$MeetingID.Replace("-","")

Now that we have the meeting ID, all we need to do is build the URL:

$Url="https://www1.gotomeeting.com/join/"+$MeetingID+"?clientType=flash"

At this point, we can launch a web browser with the URL. We create a connection to Internet Explorer first with New-Object:

$ie=new-object -ComObject internetexplorer.application

Now that we have the connection, we pass the URL that we created to Internet Explorer for navigation:

$ie.Navigate2($url)

Afterwards, we make the browser visible:

$ie.Visible=$TRUE

However, there's a small issue. What if the user was to cancel out of the input window? We don't want the URL opening a browser with blank data. We can alleviate this with a simple if statement to allow only for input with content:

If ($MeetingID) {

}

Our final script will look like this:

# Present Popup Box

[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null

$MeetingID = [Microsoft.VisualBasic.Interaction]::InputBox("GotoMeeting Flash", "GotoMeeting ID")

# Remove all hyphens from the inputted data

$MeetingID=$MeetingID.Replace("-","")

# If we get something input into the MeetingID go ahead

If ($MeetingID) {

# Build the URL

$Url="https://www1.gotomeeting.com/join/"+$MeetingID+"?clientType=flash"

# Open connection to Internet Explorer

$ie=new-object -ComObject internetexplorer.application

# Navigate to the URL in question

$ie.Navigate2($url)

# Make the Browser Visible

$ie.Visible=$TRUE

}

With all of this in place, we can launch a script that will produce a simple popup box that users can paste the MeetingID into.

The fun part is that with this configuration, you now have a solution to build URLs programmatically. You might even be able to leverage a similar solution for Lync Meetings to launch the Silverlight client by default.

How can you leverage this script? The possibilities are all up to you!

We now return you to your regularly scheduled weekend...

I invite you to follow the Scripting Guys on Twitter and Facebook. If you have any questions, send an email to the Scripting Guys at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, remember, the Power of Shell is in You.

Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy

Comments (0)

Skip to main content