jeudi 8 février 2018

Pulling information from a webpage which requires a login

I'm trying to pull information from an internal website using a remote.website URL. To get this information I need to log into the website.

$username = "username"
$password = "password"
$ie = New-Object -com InternetExplorer.Application  
$ie.visible=$false 
$ie.navigate("http://remote.website/")  while($ie.ReadyState -ne 4) {start-sleep -m 100}  
$ie.document.getElementById("ctl00_ContentPlaceHolder1_LoginView2_Login1_UserName").value= "$username" 
$ie.document.getElementById("ctl00_ContentPlaceHolder1_LoginView2_Login1_Password").value
    = "$password"  
$ie.document.getElementById("ctl00_ContentPlaceHolder1_LoginView2_Login1_LoginButton").onsubmit() start-sleep 20  
$ie.Document.body | Out-File -FilePath c:\web.txt

I'm having issues with logging in and re-directing to the page which contains tables holding the information i'm trying to access and hope someone could help me out here.

Aucun commentaire:

Enregistrer un commentaire