Automated website login through powershell script

457 views Asked by At

My goal:

  • I have to login into a OBIEE and login and download a report.
  • When I try to login with the code below get an error.

Some time script works and some times it gives error:

$Url = “www.microsoft.com” # not this website , but OBIEE report link
$Username="user_name" 
$Password="password" 
$IE = New-Object -com internetexplorer.application; 
$IE.visible = $true; 
$IE.navigate($url); 
while ($IE.Busy -eq $true) 
  { 
   Start-Sleep -Milliseconds 2000; 
   } 
$IE.Document.getElementById("UsernameElement").value = $Username 
$IE.Document.getElementByID("PasswordElement").value=$Password 
$IE.Document.getElementById("SubmitElement").Click() 
Start-Sleep 10
$IE.Document.getElementById("logout").Click()
$IE.quit();

This is the error am getting :800704a6

+Categoryinfo :Resourceunavailable(:) [newobject] , COMExecption 
1

There are 1 answers

2
Robin Moffatt On

I'd go a different route - use the supported web services API for OBIEE instead.