Guest User

Untitled

a guest
Aug 16th, 2017
1,144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $loginurl = "https://3cx.mydomain.com:5001/webclient/#/login"
  2. $wallboardurl = "https://3cx.mydomain.com:5001/webclient/#/wallboard"
  3.  
  4.  
  5. #Get process name of internet explorer to kick off the if else statement below
  6. $ProcessActive = Get-Process iexplore -ErrorAction SilentlyContinue
  7.  
  8. #Start Internet Explorer in full screen and navigate to $loginurl, this is to get 3CX web client to login first, then later we can go directly to the wallboard url since we're already logged in.
  9.  
  10.  
  11. #If internet explorer is not running then open it in fullscreen, click login button on the 3CX web client login page, wait 10 seconds then navigate to 3CX wallboard page.
  12. if ($ProcessActive -eq $null) {
  13.  
  14.     $IE = New-Object -com internetexplorer.application;
  15.     $IE.visible = $true;
  16.     $ie.fullscreen = $true;
  17.  
  18.  
  19.     $IE.navigate($loginurl);
  20.  
  21.     while ($IE.Busy -eq $true) {
  22.         Start-Sleep -Milliseconds 2000;
  23.     }
  24.  
  25.  
  26.     #Click the login button on the 3CX web client login page
  27.     $IE.Document.getElementById("submitBtn").Click()
  28.  
  29.     while ($IE.Busy -eq $true) {
  30.         Start-Sleep -Milliseconds 2000;
  31.     }
  32.  
  33.     #Wait 10 seconds after clicking Login button and then navigate straight to wallboard url
  34.     start-sleep -Seconds 10
  35.     $IE.navigate($wallboardurl);
  36.  
  37. }
  38.  
  39. #Else if internet explorer isn't running then refresh the internet explorer windows
  40. else {
  41.     $ieSet = (New-Object -ComObject Shell.Application).Windows() |  Where-Object {$_.LocationUrl -like "*"}
  42.     $ieSet.Refresh()
  43. }
Advertisement
Add Comment
Please, Sign In to add comment