I am trying to install chocolatey by following official documentation (https://chocolatey.org/install), this is what I am doing :
1-I am opening a cmd.exe running as administrator
2-I am running the following command : powershell and then switch into powershell mode
3-I am running the following command : $PSVersionTable.PSVersion and then get the following result : major:5 minor:1 build:16299 revision:785
4-I am running the following command : Get-ExecutionPolicy and then get the following result : RemoteSigned
5-I am running the following command : Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('http
s://chocolatey.org/install.ps1')) and get the following error :
Exception calling "DownloadString" with "1" argument(s): "Unable to connect to the remote server"
At line:1 char:51
+ ... ess -Force; iex ((New-Object System.Net.WebClient).DownloadString('ht ...
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : WebException
I am working in a company (our os is windows 10 enterprise), and when trying or any colleague machine it’s working perfectly and there is no (from what we have seen) any configuration difference between them and me.
Thanks in advance
There is nothing wrong with the code you tried. Basically, it is telling you that you are unable to connect, which might be a restriction or policy. Try the following:
$req = [System.Net.HttpWebRequest]::Create("https://www.google.com")
$req.Proxy = [System.Net.WebRequest]::DefaultWebProxy
$req.Proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
Then run the comment again. It has something to do with the credentials used in windows 10 for the request.