Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Supress or hide IE when parsing a response from Invoke-WebRequest

$
0
0

I have a script that makes a request to download some files. The site uses certificate authentication so when I request the file (Invoke-WebRequest) it will return a form that I have to send back to the action url usingInvoke-RestMethod. The code below works but it opens a new IExplorer instance to parse the form out of the response for every single call to$response.forms["form"]. This really causes a problem when I am looping over this code and requesting a lot of files. Is there a way to suppress IE? Something like $IE.visible = $false?

I should mention I tried to use the -UseBasicParsing option but I am not able to get all of the information I need from $response.InputFields or anything else.

Thanks for your help!

$response =Invoke-WebRequest-uri $url -Certificate $certInvoke-RestMethod-uri $form_action_url -body $response.forms["form"]-method Post-OutFile $file


Viewing all articles
Browse latest Browse all 21975

Trending Articles