How to fix "iwr/irm : Unable to connect to the remote server error" in Powershell 5.1

aashish kumar 26 Reputation points
2022-12-05T23:01:05.023+00:00

Hello I am trying to install Scoop in my Windows 10 machine via following commands

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time

irm get.scoop.sh | iex

I had already installed scoop ones, but I uninstalled it recently and now when, I am trying to install it again
it gives me following error:

irm : Unable to connect to the remote server

At line:1 char:2

  • irm get.scoop.sh | iex
  • ~~~~~~~~~~~~~~~~
  • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExcetion
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

i also tried installing spicetify andi got the similar error.

iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install_curl.ps1 | iex

error:

iwr : Unable to connect to the remote server
At line:1 char:1

  • iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-cli/m ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
  • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

For the information:

1)i recently got a new Fiber connection in my home and before that it used to work.
Just to let you know if there is any proxy error or something (c=got a hint about it from web).

Thanks you in advance.

Windows for business | Windows Client for IT Pros | Networking | Network connectivity and file sharing
Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
{count} vote

Accepted answer
  1. MotoX80 36,416 Reputation points
    2022-12-11T16:58:46.703+00:00

    Go find a friend and see if their PC resolves raw.githubusercontent.com to that IP address.

    Did you do that? Have someone on another PC in India do an "nslookup raw.githubusercontent.com". What IP do they see? Do they use the same ISP that you do?

    As for these addresses i have tried out in powershell 7.1 and 5.1

    This has nothing to do with any version of powershell. It is a networking issue.

    As for the Problem with ISP can you be more detailed on this part as i am quite new in this field.

    The question is: why does raw.githubusercontent.com resolve to 49.44.79.236 on your pc?

    I used Nmap to analyze that IP and it found 2 open ports, 554 and 7070. HTTP and HTTPS are NOT open. That is not a web server. Nmap reports that it is probably a cable modem.

    269375-image.png

    My laptop is configured to use DHCP from my WIFI router. It serves as the DNS server to resolve local names on my network. Run "ipconfig /all" to see your pc's DNS servers. What are they?

    To resolve internet based names, my router uses 2 Verizon (my ISP) DNS servers. I can see that in my routers configuration.

    Paste these commands into a command prompt window. It will query the currently configured DNS servers and also the Google DNS servers.

    nslookup.exe get.scoop.sh  
    nslookup.exe get.scoop.sh 8.8.8.8  
    nslookup.exe raw.githubusercontent.com   
    nslookup.exe raw.githubusercontent.com 8.8.8.8  
    

    If your pc uses your router for DNS you should see that in the "server".

    269329-image.png

    In that case you would need to logon to your router and see what DNS servers it is configured for. Here is what mine looks like.

    269330-image.png

    What address is your router using?

    My Verizon DNS server resolves the names correctly.

    269411-image.png

    One option you have is to set your NIC or your router to use Google's 8.8.8.8 DNS server.

    You would first want to try to understand what DNS servers you are using and why the names resolve as they do.


18 additional answers

Sort by: Most helpful
  1. aashish kumar 26 Reputation points
    2022-12-11T20:27:14.477+00:00

    Hey @MotoX80 thanks for reaching out to me and sorry for delay

    Go find a friend and see if their PC resolves raw.githubusercontent.com to that IP address.
    Did you do that? Have someone on another PC in India do an "nslookup raw.githubusercontent.com". What IP do they see?

    yes, I tried it in my friends Pc and here are the results
    269415-screenshot-2022-12-11-184147.png

    NOTE: (up ahead) Following Tests are performed on my computer using different routers

    my friend-1 router with same ISP
    269358-f1sr.png

    my friend-2 router with different ISP
    269431-f2dr.png

    Using Hostspot thetring (different ISP)
    269423-fmy.png

    Run "ipconfig /all" to see your pc's DNS servers. What are they?

    269416-screenshot-2022-12-12-012434.png

    Paste these commands into a command prompt window. It will query the currently configured DNS servers and also the Google DNS servers.

    here are the results:
    269359-screenshot-2022-12-12-012505.png
    269424-screenshot-2022-12-12-012554.png

    If your pc uses your router for DNS you should see that in the "server".
    What address is your router using?
    I use Reliance Jio (My ISP) with public IP 49.37.67.251

    i logged in and checked here it shows:
    269432-jio-sttus.png

    I tried to test again using my routers dns, here is what i got
    269376-screenshot-2022-12-12-012620mydns.png

    Seeing all these results i concluded that may be its the problem with my ISP and not with router or anything so i tried to connect to vpn and it worked smoothly with no errors using my router and then i came across a subreddit discussion which stated like my Isp has blocked raw.githubusercontent.com , i don't know why they decided to do so but it seems the case.

    link of reddit forum : https://www.reddit.com/r/india/comments/n3b9jc/jiofiber_blocked_access_to_rawgithubusercontentcom/

    Do i need to reach them out for the querry or there i some other to use it like you said using google dns
    or go on with vpn?


  2. Rich Matheisen 47,906 Reputation points
    2022-12-11T20:54:36.457+00:00

    There are othe complaints about JIO blocking access to other web sites. It's not just the github ones.

    i-cant-access-my-github-raw-githubusercontent-com-files

    0 comments No comments

  3. MotoX80 36,416 Reputation points
    2022-12-11T21:35:41.537+00:00

    This site: https://www.intodns.com/jio.com says that the Jio DNS servers are these:

    ns1.jio.com. ['49.40.1.65'] [TTL=172800]
    ns2.jio.com. ['49.40.1.66'] [TTL=172800]
    ns3.jio.com. ['49.45.0.84'] [TTL=172800]
    ns4.jio.com. ['49.45.0.212'] [TTL=172800]

    Try using those dns servers and see if the name resolves to the correct IP.

    nslookup raw.githubusercontent.com 49.40.1.65  
    

    If it does, then contact Jio support and ask them why jio-cachedns.jio.com and ns1.jio.com return different addresses.

    If 49.40.1.65 works, Then change the DNS settings on your router to that IP. You may also have to remove the IPV6 dns address. You would have to test that. You could also use Google's 8.8.8.8 address these.

    Or just use the VPN.

    269319-image.png

    0 comments No comments

  4. aashish kumar 26 Reputation points
    2022-12-13T18:00:04.977+00:00

    Hey @MotoX80 ,

    i asked my ISP and they answered that they have no information about this matter and will look into it but most likely it is blocked by my ISP, and I changed my IPv4 and IPv6 primary and secondary DNS to Cloudflare and it worked fine. So, I get this solves the issue , further I will change my primary and secondary dns of router to Cloudflare or google to resolve the problem, i will most Likely avoid to mess with the system32 folder.
    Thanks for your help.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.