how to by pass license agreement while downloading from any site


I am downloading one file extension (.tgz) from splunk website which has a license agreement so in order to download the file first you have to login splunk and then it shows the page of license agreement and when you accept it then file will be visible for downloading. I have made one script in which it is successfully logged in the splunk account and downloading the file but not fully. The file size is around 104 kb but it is downloading 44.7kb so anybody can help me please in order to complete this task? Here is my code -

$postParams = @{username=‘username’;password=‘password’}
Invoke-WebRequest -Uri
-Method POST -Body $postParams
$url = “
$downloadpath = “C:\Users\ankitpar\Downloads\splunk-addon-for-microsoft-azure_102.tgz”
Invoke-WebRequest -Uri $url -OutFile $downloadpath

if you will run above given script upto the second line so it shows in output of powershell that HTTP response 200 OK connection keep-alive which means i have successfully logged in.

Thanks in advance

This is probably something you should take to Splunk. Honestly, without digging into the very specifics of their web site - which isn’t really a PowerShell question - there’s no way to answer the question.

Thanks for your output… thinking the same …

Hi Don,

Finally it works… made it…

$username = “username”
$password = “password”
$ie = New-Object -com InternetExplorer.Application
while($ie.ReadyState -ne 4) {start-sleep -Seconds 5}
$ie.document.getElementById(“username”).value= “$username”
$ie.document.getElementById(“pass”).value = “$password”
$ienew = New-Object -com InternetExplorer.Application
while($ienew.ReadyState -ne 4) {start-sleep -Seconds 5}