r/PowerShell • • May 29 '26

Solved Invoke-WebRequest to call the reddit api suddenly broken

Been running a script forever without issue. You don't need OAuth2 to grab the last 100 comments of a user like this:

https://api.reddit.com/user/spez.json?limit=100&after=

or

https://www.reddit.com/user/spez.json?limit=100&after=

A few months ago I added the -UseBasicParsing tag.

Today I'm getting

+ CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

My line of code is $response = Invoke-WebRequest -UseBasicParsing $url | ConvertFrom-Json where $url looks like the https lines above.

Can anyone shed light, please? Thanks.

25 Upvotes

11 comments sorted by

View all comments

Show parent comment

3

u/JazzGreenway May 29 '26

Yes but curl.exe is also included in Windows as a binary. You need to specify the .exe though.