Advertisement
Guest User

Untitled

a guest
Apr 9th, 2019
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Prompt and store credentials for Intermedia sign in page
  2.  
  3. $Cred=Get-Credential
  4.  
  5. #Function to force IE to wait so that page elements load before trying to retrieve the HTML document. Set a fairly high default (10s) because depending on the frame, it could actually take that long...
  6.  
  7. $DefaultTimeinMS = 10000
  8. Function IEWait ($TimeinMS) {
  9.     If ($TimeinMS){
  10.     While ($ieObject.Busy -eq $True) {Sleep -Milliseconds $TimeinMS}
  11.         }
  12.     Else {
  13.     $TimeinMS =  $DefaultTimeinMS
  14.     While ($ieObject.Busy -eq $True) {Sleep -Milliseconds $TimeinMS}
  15.         }
  16.     }
  17.  
  18. #Main body of script
  19.  
  20. $ieObject = New-Object -ComObject 'InternetExplorer.Application'
  21. $ieObject.Visible = $True
  22. $ieObject.Navigate('https://cp.serverdata.net/Portal/Partner/Login')
  23. IEWait 500
  24. $CurrentDocument = $ieObject.Document
  25. $Username = $CurrentDocument.IHTMLDocument3_getElementsByTagName("input") | Where-Object {$_.Name -eq "login"}
  26. $Password = $CurrentDocument.IHTMLDocument3_getElementsByTagName("input") | Where-Object {$_.Name -eq "password"}
  27. $Username.value = $Cred.UserName
  28. $Password.value = $Cred.GetNetworkCredential().Password
  29. $SubmitButton = $Currentdocument.IHTMLDocument3_getElementsByTagName("Button") | Where-Object {$_.ClassName -eq "login-submit"}
  30. $SubmitButton.Click()
  31. IEWait 500
  32. $ieObject.Navigate('https://cp.serverdata.net/ControlPanel/Account/LoginToAccount?accountID=*customer#*')
  33. IEWait 500
  34. $ieObject.Navigate('https://cp.serverdata.net/aspx/Office365/Home/licenses#/installed/licenses')
  35. IEWait 20000
  36. $CurrentDocument = $ieObject.Document
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement