Questions tagged [invoke-webrequest]
256 questions
2
votes
1 answer
Powershell Invoke-WebRequest returns array of objects but processes as if there is only 1
$path = "https://api.statuspage.io/v1/pages/$page_id/$endpoint"
$req = Invoke-WebRequest -Uri $path -Method GET
This request returns an array of objects (50+). I can see this by running a Write-Host $req
Problem is, when I try something…

vin_Bin87
- 318
- 8
- 18
2
votes
1 answer
PowerShell: How can I determine if Invoke-WebRequest has timed out?
I need to produce some output when Invoke-WebRequest exceeds the time limit set by the -TimeoutSec parameter. How can I build an If condition that runs when this is the case?
In other words; what goes in place of ????? in the example below?:
Try {
…

Sivan
- 23
- 6
2
votes
0 answers
-UseDefaultCredential vs. -Credential in PowerShell (401 Error)
I am writing a script in PowerShell that is testing login credentials to a target SharePoint 2013 URL that are passed through to an Invoke-WebRequest command that calls the URL in question. When I use -UseDefaultCredential, the returned status is a…

Eric K.
- 121
- 3
- 17
2
votes
1 answer
Invoke webrequest fails to fetch website data even though works in all browsers
Powershell: The invoke-webrequest is not working for me for a particular site. Tried many things like setting TLS settings etc. But still fails.
One unique thing is it works for first request, post then it fails for 15mins but such is not the case…

prakash
- 63
- 7
2
votes
2 answers
How to get Location header when URL redirected using Invoke-WebRequest in powershell
Calling a URL which permanently moved or redirected, does not return Location http header or the correct location.
it seems that URL redirection is being performed during URL call ( http status code : 302, 301 etc ).
How do I overcome this ?

Etay Gudai 972-522-3322-47
- 599
- 8
- 20
2
votes
1 answer
Translating Curl request to Invoke-WebRequest with --data-urlencode parameter
I'm trying to request data from Mixpanel via there API.
Mixpanel JQL Getting Started
I can run a modified version of their basic example script and receive data.
# sends the JQL code in `query.js` to the api
# to a project with sample data for this…

bob0the0mighty
- 782
- 11
- 28
2
votes
1 answer
PowerShell error has full SOAP Response not the contents
I'm calling an SOAP API. PowerShell is giving an error and the error contains the response I am expecting! Whereas the contents of the variable I'm sending the response to is missing some data.
[xml]$response = Invoke-WebRequest -Uri $UserURI…

synchmaster
- 21
- 1
2
votes
1 answer
Invoke-WebRequest Links property value begins with about://
I'm working on a SCCM Application Packager recipe to automate the download, packaging, and deployment of JetBrains Toolbox. I'm trying to use the Invoke-WebRequest cmdlet to assign the href value where the outer text is "direct link" to a variable…

senseiTX
- 21
- 4
2
votes
0 answers
Why does Invoke-Webrequest return foreign characters correctly and cURL doesn't?
Normally I use cURL for pretty much everything but I just noticed that it doesn't really return the HTML content properly when it comes to foreign characters, like cyrillic or german umlauts etc.
For example
Select-String -InputObject…

YTZ
- 876
- 11
- 26
2
votes
2 answers
Invoke-Webrequest gets 401 on POST but not on GET with Basic Auth
I have a dev site with Basic Auth enabled. I am get to GET a page using the following to add basic auth to the headers:
$creds = "$($BASIC_AUTH_USER):$($BASIC_AUTH_PASS)"
$encodedCreds =…

sheamus
- 3,001
- 4
- 31
- 54
1
vote
0 answers
Login Web with Invoke-WebRequest not working
I'm trying to automate a login into a webpage via invokewebrequest.
$urlLogin =…

Daniziz
- 88
- 7
1
vote
1 answer
Fetching Table from website | web scrapping - Powershell Invoke-webrequest
Trying to fetch the table of content using h3 tag.
link- https://learn.microsoft.com/en-us/troubleshoot/sql/releases/download-and-install-latest-updates
Trying to fetch the whole table of 'SQL Server 2019'. and convrting into json object in…

scode123
- 49
- 4
1
vote
1 answer
fetching SQL product name using version from microsoft website - powershell / Invoke-webrequest
I working on scrapping microsoft website where i want to fetch sql product name such as "SQL Version 2012" using their version "11.0.6607.3".
Basically I want to search for their product name using their Version. Help me with powershell using…

scode123
- 49
- 4
1
vote
1 answer
Powershell webrequest handle response code and exit
I want it to exit when the response status code is 429, how can I do it? my looped ps1 script
I don't want to use do or try or catch methods. Is there a simple method? this is my code and i want it to exit when response code 429
'header' =…

nomiks
- 19
- 3
1
vote
2 answers
Any way to achieve what 'curl -s -w %{redirect_url} "some_url"' does with 'Invoke-WebRequest'?
I am trying to convert following from bash to PowerShell:
url="https://api.adoptium.net/v3/binary/latest/19/ga/linux/x64/jdk/hotspot/normal/eclipse"
fetch_url=$( curl -s -w %{redirect_url} "${url}" )
fname=$( curl -OLs -w %{filename_effective}…

Thomas Schweikle
- 45
- 3