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 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,487 questions
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,341 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,510 questions
{count} vote

Accepted answer
  1. MotoX80 33,376 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. Avinash DV 1 Reputation point
    2022-12-22T11:08:34.443+00:00

    Hi @aashish kumar ,

    If you are still facing the issue with "Unable to connect to server" for installing Scoop. Try the below method:

    • Install a vpn on windows machine: ProtonVPN worked for me.(A signup & login required but free).
    • Try connecting to other countries (I got connected to netherlands) and run the command on powershell.
    • It worked for me once I ran the command after connecting to VPN.

    The issue is that we can't connect to https://raw.githubusercontent.com/scoopinstaller/install/master/install.ps1 from India.
    Once I changed the country, the installation was successful.

    P.S: Apologies, if the issue is much bigger than that, as I haven't gone through complete thread.


  2. ranjith 0 Reputation points
    2023-05-15T18:23:40.26+00:00

    bro just use vpn ,it works

    0 comments No comments

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.