Invoke-WebRequest: Unable to connect to the remote server

dova

New Member
I didn't remove anything from remoting or network but i cannot use Invoke-WebRequest with powershell
everytime i use it i got this error, any ideas what might be causing it ? since i don't remove anything from remoting or network

image 28.jpg

what might be causing this problem ? or how can i protect this feature ? i do many things with it
 
Reinstall Edge from the download site. Then you don't have to re-image to confirm it's the root cause.
 
Most of the time pundits claim removing the browser causes "no harm". Except when your framework depends on some IE11 library, this sounds like that case. Restore IE, I'd imagine WU will try to upgrade you to Edge if it's not already installed.

https://techcommunity.microsoft.com...er-11-desktop-app-retirement-faq/ba-p/2366549

MichaelMcCool Occasional Visitor
May 19 2021 02:55 PM

How does this retirement affect Windows PowerShell 5.1? PowerShell leverages IE11 to perform the parsing of Invoke-WebRequest. Will this retirement also affect scripting of IE using its COM object? Some Microsoft sites like the Microsoft Update Catalog use javascript code for the next/back buttons instead of actual links. This makes it impossible to follow the next page links when scripting in PowerShell without leveraging a full browser. The IE COM object was a useful way to parse data from these sorts of sites programmatically. Will this functionality still be available after retirement and if not, is there an available alternative?
 
Last edited:
Attach your preset, maybe it's some other dependency.
I could not thank you enough for your patience and help i really appreciate it

few notes:
i started to remove desktop remote services from network and some stuff from privacy and remoting since it was not the issue
 

Attachments

  • test.xml
    37.1 KB
Tried that but nope still same problem, thanks anyway for your efforts
I used msmg toolkit before and i always remove both internet explorer and edge and i never faced this issue before
now i have both edge legay and chromium and explorer still same issue
 
Last edited:
I don't know what causes this 100% but I had similar issue with .NET it ended up being too many things taken out of the image and permissions broken. I cleaned the cache folder(s), made COMPLETELY uninstalled NTlite and started fresh with new install, fresh copy of Windows, started over and didn't have the problem again. It was weird like NT AUTHORITY/SYSTEM account did not have full rights to .net folders and broke a ton of things. I think I had corruption with my ISO extracted folder or just f***ed something up bad.
 
Tried that but nope still same problem, thanks anyway for your efforts
I used msmg toolkit before and i always remove both internet explorer and edge and i never faced this issue before
now i have both edge legay and chromium and explorer still same issue
Did you find a solution to this ? I have tried the aforementioned fixes but it didn't work for me either , tried using a combination of apps , MSMG Toolkit , WinToolkit (it does work all the way upto Win11) , this problem started popping up way back around when this thread started for me as well and still dont have a defintive solution to this , am stuck cause I use a lot of GitHub projects which rely on invoke-webrequest to fetch info .. the problem did somehow get solved a while back by just leaving all the networking components as is and the os worked fine untill last month after a update (not sure if the update caused it, just a guess) and since then have tried multiple things with no luck , any suggestions ?
 
Did you find a solution to this ? I have tried the aforementioned fixes but it didn't work for me either , tried using a combination of apps , MSMG Toolkit , WinToolkit (it does work all the way upto Win11) , this problem started popping up way back around when this thread started for me as well and still dont have a defintive solution to this , am stuck cause I use a lot of GitHub projects which rely on invoke-webrequest to fetch info .. the problem did somehow get solved a while back by just leaving all the networking components as is and the os worked fine untill last month after a update (not sure if the update caused it, just a guess) and since then have tried multiple things with no luck , any suggestions ?
We're not here to support MSMG, WinToolkit or other debloating projects. They have their own online communities that can answer your questions. Invoke-WebRequest requires the IE11 compatibility libraries in Edge.

End of story.
 
We're not here to support MSMG, WinToolkit or other debloating projects. They have their own online communities that can answer your questions. Invoke-WebRequest requires the IE11 compatibility libraries in Edge.

End of story.
No no no , that's not what I meant , I didn't quite ask for support on MSMG Toolkit or WinToolkit , I just mentioned having used them , that's that , my main issue was invoke-webrequest and always have kept Edge-legacy and IE11 untouched , and that didn't help with the issue ..
 
-UseBasicParsing is used to bypass IE (unless you're on PS 6+ where it's the default), and enforce Tls12 support since older TLS certificates (< 1.2) is being forced out of Windows.

Code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
 
Last edited:
-UseBasicParsing is used to bypass IE (unless you're on PS 6+ where it's the default), and enforce Tls12 support since older TLS certificates (< 1.2) is being forced out of Windows.

Code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
As I mentioned , I use some apps and projects from GitHub that fetch using invoke-webrequest so unfortunately I do not have the proper knowledge to change the fetch method in the app itself , but from what I understand this issue is generally caused by pre Powershell 6 only ? Meaning if I use Powershell 7 should this issue be fixed ?
 
As I mentioned , I use some apps and projects from GitHub that fetch using invoke-webrequest so unfortunately I do not have the proper knowledge to change the fetch method in the app itself , but from what I understand this issue is generally caused by pre Powershell 6 only ? Meaning if I use Powershell 7 should this issue be fixed ?
Well , tried using Powershell 7 as well with my apps and no luck , if you could understand the error , here's the error I got when executing one of the apps I use in PowerShell 7 , take a look : Invoke-WebRequest : Unable to connect to the remote server At line:1 char:93 + ... 2}; "& { $((Invoke-WebRequest -UseBasicParsing 'https://raw.githubuse ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
 
Back
Top