{"id":647,"date":"2014-09-21T00:01:00","date_gmt":"2014-09-21T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2014\/09\/21\/weekend-scripter-use-powershell-to-connect-to-gotomeeting\/"},"modified":"2014-09-21T00:01:00","modified_gmt":"2014-09-21T00:01:00","slug":"weekend-scripter-use-powershell-to-connect-to-gotomeeting","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/weekend-scripter-use-powershell-to-connect-to-gotomeeting\/","title":{"rendered":"Weekend Scripter: Use PowerShell to Connect to GoToMeeting"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Use Windows PowerShell to provide a GUI input and build a custom URL for Internet Explorer.<\/span><\/p>\n<p>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&#039;t that challenging, but to make the solution seamless to an end user was.<\/p>\n<p>Our challenge is to try to get a computer to connect to GoToMeeting without installing the client software.<\/p>\n<p>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, &quot;Hey, you could click here to run a version that totally doesn&#039;t need local Admin rights, dude!&quot;<\/p>\n<p>To be honest, it didn&#039;t say that, but it did take a while before the screen prompted me with an alternate method of connecting.<\/p>\n<p>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:<\/p>\n<p style=\"margin-left:30px\">https:\/\/www1.gotomeeting.com\/join\/123123123?clientType=flash<\/p>\n<p>This would launch a GoToMeeting with the ID # of 123123123.<\/p>\n<p>The answer was really quite simple:<\/p>\n<ul>\n<li>Prompt the user for the meeting ID number.<\/li>\n<li>Build the URL with the meeting ID included.<\/li>\n<li>Launch Internet Explorer with the supplied URL.<\/li>\n<\/ul>\n<p>To prompt for the meeting ID number, we could get away with using <b>Read-Host<\/b>:<\/p>\n<p style=\"margin-left:30px\">$MeetingID=READ-HOST &#039;Enter GotoMeeting ID #&#039;<\/p>\n<p>But I wanted this to be usable by normal users. I wanted a simple GUI popup for this.<\/p>\n<p>With a little digging on the Internet, I found a simple routine to provide a popup box by using Visual Basic:<\/p>\n<p style=\"margin-left:30px\">[System.Reflection.Assembly]::LoadWithPartialName(&#039;Microsoft.VisualBasic&#039;) | Out-Null<\/p>\n<p style=\"margin-left:30px\">$MeetingID = [Microsoft.VisualBasic.Interaction]::InputBox(&quot;GotoMeeting Flash&quot;, &quot;GotoMeeting ID&quot;)<\/p>\n<p>This would provide a simple text box on the screen that looks like this:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/S1.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/S1.PNG\" alt=\"Image of text box\" title=\"Image of text box\" \/><\/a><\/p>\n<p>However, in some cases, the meeting ID for GoToMeeting is presented in email in the following format:<\/p>\n<p style=\"margin-left:30px\">000-000-000<\/p>\n<p>To ensure that users could copy and paste the number into the meeting box, we can leverage a method to replace any hyphens ( <b>&#8211;<\/b> ) found with nothing:<\/p>\n<p style=\"margin-left:30px\">$MeetingID=$MeetingID.Replace(&quot;-&quot;,&quot;&quot;)<\/p>\n<p>Now that we have the meeting ID, all we need to do is build the URL:<\/p>\n<p style=\"margin-left:30px\">$Url=&quot;https:\/\/www1.gotomeeting.com\/join\/&quot;+$MeetingID+&quot;?clientType=flash&quot;<\/p>\n<p>At this point, we can launch a web browser with the URL. We create a connection to Internet Explorer first with <b>New-Object<\/b>:<\/p>\n<p style=\"margin-left:30px\">$ie=new-object -ComObject internetexplorer.application<\/p>\n<p>Now that we have the connection, we pass the URL that we created to Internet Explorer for navigation:<\/p>\n<p style=\"margin-left:30px\">$ie.Navigate2($url)<\/p>\n<p>Afterwards, we make the browser visible:<\/p>\n<p style=\"margin-left:30px\">$ie.Visible=$TRUE<\/p>\n<p>However, there&#039;s a small issue. What if the user was to cancel out of the input window? We don&#039;t want the URL opening a browser with blank data. We can alleviate this with a simple <b>if<\/b> statement to allow only for input with content:<\/p>\n<p style=\"margin-left:30px\">If ($MeetingID) {<\/p>\n<p style=\"margin-left:30px\">}<\/p>\n<p>Our final script will look like this:<\/p>\n<p style=\"margin-left:30px\"># Present Popup Box<\/p>\n<p style=\"margin-left:30px\">[System.Reflection.Assembly]::LoadWithPartialName(&#039;Microsoft.VisualBasic&#039;) | Out-Null<\/p>\n<p style=\"margin-left:30px\">$MeetingID = [Microsoft.VisualBasic.Interaction]::InputBox(&quot;GotoMeeting Flash&quot;, &quot;GotoMeeting ID&quot;)<\/p>\n<p style=\"margin-left:30px\"># Remove all hyphens from the inputted data<\/p>\n<p style=\"margin-left:30px\">$MeetingID=$MeetingID.Replace(&quot;-&quot;,&quot;&quot;)<\/p>\n<p style=\"margin-left:30px\"># If we get something input into the MeetingID go ahead<\/p>\n<p style=\"margin-left:30px\">If ($MeetingID) {<\/p>\n<p style=\"margin-left:30px\"># Build the URL<\/p>\n<p style=\"margin-left:30px\">$Url=&quot;https:\/\/www1.gotomeeting.com\/join\/&quot;+$MeetingID+&quot;?clientType=flash&quot;<\/p>\n<p style=\"margin-left:30px\"># Open connection to Internet Explorer<\/p>\n<p style=\"margin-left:30px\">$ie=new-object -ComObject internetexplorer.application<\/p>\n<p style=\"margin-left:30px\"># Navigate to the URL in question<\/p>\n<p style=\"margin-left:30px\">$ie.Navigate2($url)<\/p>\n<p style=\"margin-left:30px\"># Make the Browser Visible<\/p>\n<p style=\"margin-left:30px\">$ie.Visible=$TRUE<\/p>\n<p style=\"margin-left:30px\">}<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>How can you leverage this script? The possibilities are all up to you!<\/p>\n<p>We now return you to your regularly scheduled weekend&#8230;<\/p>\n<p>I invite you to follow the Scripting Guys on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send an email to the Scripting Guys at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, remember, the Power of Shell is in You.<\/p>\n<p><b>Sean Kearney, <\/b>Windows PowerShell MVP and Honorary Scripting Guy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#039;t that challenging, but to make [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,154,61,45],"class_list":["post-647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-sean-kearney","tag-weekend-scripter","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>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&#039;t that challenging, but to make [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=647"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/647\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}