Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This script logs into joomla local website and displays the greeting message
- #It must be ran with Administrator rights
- #Next time with HttpWebRequest calls
- $username = "user"
- $password = "pass"
- If($ie) { Remove-Variable ie }
- $ie = New-Object -com InternetExplorer.Application
- $ie.visible=$true
- $ie.navigate("http://localhost/joomla/index.php")
- while($ie.ReadyState -ne 4) {start-sleep -m 100}
- $form = $ie.document.forms[0]
- $inputs = $form.GetElementsByTagName("input")
- ($inputs | where {$_.Name -eq "username"}).Value = "$username"
- ($inputs | where {$_.Name -eq "password"}).Value = "$password"
- Start-Sleep -Second 1
- ($ie.Document.IHTMLDocument3_getElementsByTagName('button') | where-object {$_.classname -eq "btn btn-primary"}).click()
- Start-Sleep -Second 1
- ($ie.Document.body.getElementsByTagName('div') | Where {$_.getAttributeNode('class').Value -eq 'mod-login-logout__login-greeting login-greeting'}).textContent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement