Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Prompt and store credentials for Intermedia sign in page
- $Cred=Get-Credential
- #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...
- $DefaultTimeinMS = 10000
- Function IEWait ($TimeinMS) {
- If ($TimeinMS){
- While ($ieObject.Busy -eq $True) {Sleep -Milliseconds $TimeinMS}
- }
- Else {
- $TimeinMS = $DefaultTimeinMS
- While ($ieObject.Busy -eq $True) {Sleep -Milliseconds $TimeinMS}
- }
- }
- #Main body of script
- $ieObject = New-Object -ComObject 'InternetExplorer.Application'
- $ieObject.Visible = $True
- $ieObject.Navigate('https://cp.serverdata.net/Portal/Partner/Login')
- IEWait 500
- $CurrentDocument = $ieObject.Document
- $Username = $CurrentDocument.IHTMLDocument3_getElementsByTagName("input") | Where-Object {$_.Name -eq "login"}
- $Password = $CurrentDocument.IHTMLDocument3_getElementsByTagName("input") | Where-Object {$_.Name -eq "password"}
- $Username.value = $Cred.UserName
- $Password.value = $Cred.GetNetworkCredential().Password
- $SubmitButton = $Currentdocument.IHTMLDocument3_getElementsByTagName("Button") | Where-Object {$_.ClassName -eq "login-submit"}
- $SubmitButton.Click()
- IEWait 500
- $ieObject.Navigate('https://cp.serverdata.net/ControlPanel/Account/LoginToAccount?accountID=*customer#*')
- IEWait 500
- $ieObject.Navigate('https://cp.serverdata.net/aspx/Office365/Home/licenses#/installed/licenses')
- IEWait 20000
- $CurrentDocument = $ieObject.Document
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement