Proxy configuration in powershell












4














I'm trying to install chocolatey on an windows behind a proxy:



@powershell -ExecutionPolicy unrestricted


In power shell I'm executing



$wc=new-object net.webclient;
$wc.Proxy=new-object system.net.WebProxy('<myproxy-ip>:8012',$true);
$wc.Proxy.Credentials = new-object system.net.NetworkCredential('<myusername>','<mypass>');
iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));


I get the following error



Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
At line:1 char:1
+ iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : WebException


I use the same username/password that I must enter when I'm starting firefox/iexplorer (see the image). There are no default username/passwords configured for the proxy since I must always enter them.



enter image description here





More details (using Inspect Element in firefox on an Private Window)



Response Headers



Cache-Control: no-cache
Connection: close
Content-Length: 813
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Proxy-Authenticate: BASIC realm="PROXY_INTERNET"
Proxy-Connection: close
Set-Cookie: BCSI-CS-dfaeac52a135c7c0=2; Path=/









share|improve this question
























  • .Net credentials are not the same as a name and password you would type into a browser-based proxy authentication screen. Perhaps better describe the proxy and how you enter your UN/Password when using FF or IE.
    – Ƭᴇcʜιᴇ007
    Sep 10 '15 at 14:32










  • @Ƭᴇcʜιᴇ007 I hope the image helps with identifying the type of proxy.
    – raisercostin
    Sep 10 '15 at 15:09










  • No, that's not enough. We'd need the HTTP response headers where the proxy is asking for authentication.
    – Daniel B
    Sep 10 '15 at 16:17










  • I added the response headers from browser. I don't know how I could "debug" or capture the response headers in powershell. Do you have any suggestion?
    – raisercostin
    Sep 11 '15 at 9:09










  • The above example worked fine for me on Windows 7 behind an NTLM proxy :) thanks.
    – Tod Thomson
    Apr 18 '16 at 0:43
















4














I'm trying to install chocolatey on an windows behind a proxy:



@powershell -ExecutionPolicy unrestricted


In power shell I'm executing



$wc=new-object net.webclient;
$wc.Proxy=new-object system.net.WebProxy('<myproxy-ip>:8012',$true);
$wc.Proxy.Credentials = new-object system.net.NetworkCredential('<myusername>','<mypass>');
iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));


I get the following error



Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
At line:1 char:1
+ iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : WebException


I use the same username/password that I must enter when I'm starting firefox/iexplorer (see the image). There are no default username/passwords configured for the proxy since I must always enter them.



enter image description here





More details (using Inspect Element in firefox on an Private Window)



Response Headers



Cache-Control: no-cache
Connection: close
Content-Length: 813
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Proxy-Authenticate: BASIC realm="PROXY_INTERNET"
Proxy-Connection: close
Set-Cookie: BCSI-CS-dfaeac52a135c7c0=2; Path=/









share|improve this question
























  • .Net credentials are not the same as a name and password you would type into a browser-based proxy authentication screen. Perhaps better describe the proxy and how you enter your UN/Password when using FF or IE.
    – Ƭᴇcʜιᴇ007
    Sep 10 '15 at 14:32










  • @Ƭᴇcʜιᴇ007 I hope the image helps with identifying the type of proxy.
    – raisercostin
    Sep 10 '15 at 15:09










  • No, that's not enough. We'd need the HTTP response headers where the proxy is asking for authentication.
    – Daniel B
    Sep 10 '15 at 16:17










  • I added the response headers from browser. I don't know how I could "debug" or capture the response headers in powershell. Do you have any suggestion?
    – raisercostin
    Sep 11 '15 at 9:09










  • The above example worked fine for me on Windows 7 behind an NTLM proxy :) thanks.
    – Tod Thomson
    Apr 18 '16 at 0:43














4












4








4


1





I'm trying to install chocolatey on an windows behind a proxy:



@powershell -ExecutionPolicy unrestricted


In power shell I'm executing



$wc=new-object net.webclient;
$wc.Proxy=new-object system.net.WebProxy('<myproxy-ip>:8012',$true);
$wc.Proxy.Credentials = new-object system.net.NetworkCredential('<myusername>','<mypass>');
iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));


I get the following error



Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
At line:1 char:1
+ iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : WebException


I use the same username/password that I must enter when I'm starting firefox/iexplorer (see the image). There are no default username/passwords configured for the proxy since I must always enter them.



enter image description here





More details (using Inspect Element in firefox on an Private Window)



Response Headers



Cache-Control: no-cache
Connection: close
Content-Length: 813
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Proxy-Authenticate: BASIC realm="PROXY_INTERNET"
Proxy-Connection: close
Set-Cookie: BCSI-CS-dfaeac52a135c7c0=2; Path=/









share|improve this question















I'm trying to install chocolatey on an windows behind a proxy:



@powershell -ExecutionPolicy unrestricted


In power shell I'm executing



$wc=new-object net.webclient;
$wc.Proxy=new-object system.net.WebProxy('<myproxy-ip>:8012',$true);
$wc.Proxy.Credentials = new-object system.net.NetworkCredential('<myusername>','<mypass>');
iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));


I get the following error



Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
At line:1 char:1
+ iex ($wc.DownloadString('https://chocolatey.org/install.ps1'));
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : WebException


I use the same username/password that I must enter when I'm starting firefox/iexplorer (see the image). There are no default username/passwords configured for the proxy since I must always enter them.



enter image description here





More details (using Inspect Element in firefox on an Private Window)



Response Headers



Cache-Control: no-cache
Connection: close
Content-Length: 813
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Proxy-Authenticate: BASIC realm="PROXY_INTERNET"
Proxy-Connection: close
Set-Cookie: BCSI-CS-dfaeac52a135c7c0=2; Path=/






proxy powershell






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 11 '15 at 7:47

























asked Sep 10 '15 at 14:14









raisercostin

1881210




1881210












  • .Net credentials are not the same as a name and password you would type into a browser-based proxy authentication screen. Perhaps better describe the proxy and how you enter your UN/Password when using FF or IE.
    – Ƭᴇcʜιᴇ007
    Sep 10 '15 at 14:32










  • @Ƭᴇcʜιᴇ007 I hope the image helps with identifying the type of proxy.
    – raisercostin
    Sep 10 '15 at 15:09










  • No, that's not enough. We'd need the HTTP response headers where the proxy is asking for authentication.
    – Daniel B
    Sep 10 '15 at 16:17










  • I added the response headers from browser. I don't know how I could "debug" or capture the response headers in powershell. Do you have any suggestion?
    – raisercostin
    Sep 11 '15 at 9:09










  • The above example worked fine for me on Windows 7 behind an NTLM proxy :) thanks.
    – Tod Thomson
    Apr 18 '16 at 0:43


















  • .Net credentials are not the same as a name and password you would type into a browser-based proxy authentication screen. Perhaps better describe the proxy and how you enter your UN/Password when using FF or IE.
    – Ƭᴇcʜιᴇ007
    Sep 10 '15 at 14:32










  • @Ƭᴇcʜιᴇ007 I hope the image helps with identifying the type of proxy.
    – raisercostin
    Sep 10 '15 at 15:09










  • No, that's not enough. We'd need the HTTP response headers where the proxy is asking for authentication.
    – Daniel B
    Sep 10 '15 at 16:17










  • I added the response headers from browser. I don't know how I could "debug" or capture the response headers in powershell. Do you have any suggestion?
    – raisercostin
    Sep 11 '15 at 9:09










  • The above example worked fine for me on Windows 7 behind an NTLM proxy :) thanks.
    – Tod Thomson
    Apr 18 '16 at 0:43
















.Net credentials are not the same as a name and password you would type into a browser-based proxy authentication screen. Perhaps better describe the proxy and how you enter your UN/Password when using FF or IE.
– Ƭᴇcʜιᴇ007
Sep 10 '15 at 14:32




.Net credentials are not the same as a name and password you would type into a browser-based proxy authentication screen. Perhaps better describe the proxy and how you enter your UN/Password when using FF or IE.
– Ƭᴇcʜιᴇ007
Sep 10 '15 at 14:32












@Ƭᴇcʜιᴇ007 I hope the image helps with identifying the type of proxy.
– raisercostin
Sep 10 '15 at 15:09




@Ƭᴇcʜιᴇ007 I hope the image helps with identifying the type of proxy.
– raisercostin
Sep 10 '15 at 15:09












No, that's not enough. We'd need the HTTP response headers where the proxy is asking for authentication.
– Daniel B
Sep 10 '15 at 16:17




No, that's not enough. We'd need the HTTP response headers where the proxy is asking for authentication.
– Daniel B
Sep 10 '15 at 16:17












I added the response headers from browser. I don't know how I could "debug" or capture the response headers in powershell. Do you have any suggestion?
– raisercostin
Sep 11 '15 at 9:09




I added the response headers from browser. I don't know how I could "debug" or capture the response headers in powershell. Do you have any suggestion?
– raisercostin
Sep 11 '15 at 9:09












The above example worked fine for me on Windows 7 behind an NTLM proxy :) thanks.
– Tod Thomson
Apr 18 '16 at 0:43




The above example worked fine for me on Windows 7 behind an NTLM proxy :) thanks.
– Tod Thomson
Apr 18 '16 at 0:43










3 Answers
3






active

oldest

votes


















0














Can't test it (don't have a similar Proxy available to me), so I actually have no idea if this will work, but here's something you can try:



$wc = new-object net.webclient;
$proxyUri = new-object system.uri("http://<myproxy-ip>:8012");
$wc.Proxy = new-object system.net.WebProxy($proxyUri, $true);
$cachedCredentials = new-object system.net.CredentialCache;
$netCredential = new-object system.net.NetworkCredential("<myusername>", "<mypass>");

$cachedCredentials.Add($proxyUri, "Basic", $netCredential);

$wc.Proxy.Credentials = $cachedCredentials.GetCredential($proxyUri, "Basic");

iex ($wc.DownloadString("https://chocolatey.org/install.ps1"));


The intention is to use a CredentialCache object to force the credentials into using "Basic" authentication mode.






share|improve this answer





























    0














    See https://github.com/chocolatey/chocolatey/wiki/Proxy-Settings-for-Chocolatey



    In powershell define the function



    function Create-Proxy($proxyHost,$proxyPort,$proxyUsername,$proxyPassword){
    #$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
    $proxyUrl = $proxyHost+":"+$proxyPort;
    Write-Host "proxy url [$proxyUrl]";
    $proxy = New-Object System.Net.WebProxy($proxyUrl, $true);
    $passwd = ConvertTo-SecureString $proxyPassword -AsPlainText -Force; ## Website credentials
    $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($proxyUsername, $passwd);
    return $proxy;
    }


    call it like



    $wc=new-object net.webclient;
    $wc.UseDefaultCredentials = $true
    $wc.Proxy = Create-Proxy "<proxy-host>" "<proxy-port>" "<proxy-username>" "<proxy-clear-pass>"
    $wc.DownloadString('https://chocolatey.org/install.ps1');




    What I discovered is that the actual download worked, but the execution of the installer didn't since it used a custom constructed proxy.



    So the iex ($wc.DownloadString("https://chocolatey.org/install.ps1")); fails because the bad proxy configuration inside the downloaded install.ps1






    share|improve this answer































      0














      You can use this. Worked for me.
      https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey



      Explicit Proxy Settings



      Chocolatey has explicit proxy support starting with 0.9.9.9.



      You can simply configure 1 or 3 settings and Chocolatey will use a proxy server. proxy is required and is the location and port of the proxy server. proxyUser and proxyPassword are optional. The values for user/password are only used for credentials when both are present.



      choco config set proxy <locationandport>
      choco config set proxyUser <username>
      choco config set proxyPassword <passwordThatGetsEncryptedInFile>


      Example



      Running the following commands in 0.9.9.9:



      choco config set proxy http://localhost:8888
      choco config set proxyUser bob
      choco config set proxyPassword 123Sup#rSecur3





      share|improve this answer





















      • This answer explains how to configure Chocolatey to use a proxy. The question asks how to install Chocolatey from behind a proxy. This answer will be useful after that, but it's not what the question was asking.
        – anaximander
        May 18 '17 at 12:21











      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f971103%2fproxy-configuration-in-powershell%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Can't test it (don't have a similar Proxy available to me), so I actually have no idea if this will work, but here's something you can try:



      $wc = new-object net.webclient;
      $proxyUri = new-object system.uri("http://<myproxy-ip>:8012");
      $wc.Proxy = new-object system.net.WebProxy($proxyUri, $true);
      $cachedCredentials = new-object system.net.CredentialCache;
      $netCredential = new-object system.net.NetworkCredential("<myusername>", "<mypass>");

      $cachedCredentials.Add($proxyUri, "Basic", $netCredential);

      $wc.Proxy.Credentials = $cachedCredentials.GetCredential($proxyUri, "Basic");

      iex ($wc.DownloadString("https://chocolatey.org/install.ps1"));


      The intention is to use a CredentialCache object to force the credentials into using "Basic" authentication mode.






      share|improve this answer


























        0














        Can't test it (don't have a similar Proxy available to me), so I actually have no idea if this will work, but here's something you can try:



        $wc = new-object net.webclient;
        $proxyUri = new-object system.uri("http://<myproxy-ip>:8012");
        $wc.Proxy = new-object system.net.WebProxy($proxyUri, $true);
        $cachedCredentials = new-object system.net.CredentialCache;
        $netCredential = new-object system.net.NetworkCredential("<myusername>", "<mypass>");

        $cachedCredentials.Add($proxyUri, "Basic", $netCredential);

        $wc.Proxy.Credentials = $cachedCredentials.GetCredential($proxyUri, "Basic");

        iex ($wc.DownloadString("https://chocolatey.org/install.ps1"));


        The intention is to use a CredentialCache object to force the credentials into using "Basic" authentication mode.






        share|improve this answer
























          0












          0








          0






          Can't test it (don't have a similar Proxy available to me), so I actually have no idea if this will work, but here's something you can try:



          $wc = new-object net.webclient;
          $proxyUri = new-object system.uri("http://<myproxy-ip>:8012");
          $wc.Proxy = new-object system.net.WebProxy($proxyUri, $true);
          $cachedCredentials = new-object system.net.CredentialCache;
          $netCredential = new-object system.net.NetworkCredential("<myusername>", "<mypass>");

          $cachedCredentials.Add($proxyUri, "Basic", $netCredential);

          $wc.Proxy.Credentials = $cachedCredentials.GetCredential($proxyUri, "Basic");

          iex ($wc.DownloadString("https://chocolatey.org/install.ps1"));


          The intention is to use a CredentialCache object to force the credentials into using "Basic" authentication mode.






          share|improve this answer












          Can't test it (don't have a similar Proxy available to me), so I actually have no idea if this will work, but here's something you can try:



          $wc = new-object net.webclient;
          $proxyUri = new-object system.uri("http://<myproxy-ip>:8012");
          $wc.Proxy = new-object system.net.WebProxy($proxyUri, $true);
          $cachedCredentials = new-object system.net.CredentialCache;
          $netCredential = new-object system.net.NetworkCredential("<myusername>", "<mypass>");

          $cachedCredentials.Add($proxyUri, "Basic", $netCredential);

          $wc.Proxy.Credentials = $cachedCredentials.GetCredential($proxyUri, "Basic");

          iex ($wc.DownloadString("https://chocolatey.org/install.ps1"));


          The intention is to use a CredentialCache object to force the credentials into using "Basic" authentication mode.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 10 '15 at 15:54









          Ƭᴇcʜιᴇ007

          98.8k14156212




          98.8k14156212

























              0














              See https://github.com/chocolatey/chocolatey/wiki/Proxy-Settings-for-Chocolatey



              In powershell define the function



              function Create-Proxy($proxyHost,$proxyPort,$proxyUsername,$proxyPassword){
              #$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
              $proxyUrl = $proxyHost+":"+$proxyPort;
              Write-Host "proxy url [$proxyUrl]";
              $proxy = New-Object System.Net.WebProxy($proxyUrl, $true);
              $passwd = ConvertTo-SecureString $proxyPassword -AsPlainText -Force; ## Website credentials
              $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($proxyUsername, $passwd);
              return $proxy;
              }


              call it like



              $wc=new-object net.webclient;
              $wc.UseDefaultCredentials = $true
              $wc.Proxy = Create-Proxy "<proxy-host>" "<proxy-port>" "<proxy-username>" "<proxy-clear-pass>"
              $wc.DownloadString('https://chocolatey.org/install.ps1');




              What I discovered is that the actual download worked, but the execution of the installer didn't since it used a custom constructed proxy.



              So the iex ($wc.DownloadString("https://chocolatey.org/install.ps1")); fails because the bad proxy configuration inside the downloaded install.ps1






              share|improve this answer




























                0














                See https://github.com/chocolatey/chocolatey/wiki/Proxy-Settings-for-Chocolatey



                In powershell define the function



                function Create-Proxy($proxyHost,$proxyPort,$proxyUsername,$proxyPassword){
                #$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
                $proxyUrl = $proxyHost+":"+$proxyPort;
                Write-Host "proxy url [$proxyUrl]";
                $proxy = New-Object System.Net.WebProxy($proxyUrl, $true);
                $passwd = ConvertTo-SecureString $proxyPassword -AsPlainText -Force; ## Website credentials
                $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($proxyUsername, $passwd);
                return $proxy;
                }


                call it like



                $wc=new-object net.webclient;
                $wc.UseDefaultCredentials = $true
                $wc.Proxy = Create-Proxy "<proxy-host>" "<proxy-port>" "<proxy-username>" "<proxy-clear-pass>"
                $wc.DownloadString('https://chocolatey.org/install.ps1');




                What I discovered is that the actual download worked, but the execution of the installer didn't since it used a custom constructed proxy.



                So the iex ($wc.DownloadString("https://chocolatey.org/install.ps1")); fails because the bad proxy configuration inside the downloaded install.ps1






                share|improve this answer


























                  0












                  0








                  0






                  See https://github.com/chocolatey/chocolatey/wiki/Proxy-Settings-for-Chocolatey



                  In powershell define the function



                  function Create-Proxy($proxyHost,$proxyPort,$proxyUsername,$proxyPassword){
                  #$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
                  $proxyUrl = $proxyHost+":"+$proxyPort;
                  Write-Host "proxy url [$proxyUrl]";
                  $proxy = New-Object System.Net.WebProxy($proxyUrl, $true);
                  $passwd = ConvertTo-SecureString $proxyPassword -AsPlainText -Force; ## Website credentials
                  $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($proxyUsername, $passwd);
                  return $proxy;
                  }


                  call it like



                  $wc=new-object net.webclient;
                  $wc.UseDefaultCredentials = $true
                  $wc.Proxy = Create-Proxy "<proxy-host>" "<proxy-port>" "<proxy-username>" "<proxy-clear-pass>"
                  $wc.DownloadString('https://chocolatey.org/install.ps1');




                  What I discovered is that the actual download worked, but the execution of the installer didn't since it used a custom constructed proxy.



                  So the iex ($wc.DownloadString("https://chocolatey.org/install.ps1")); fails because the bad proxy configuration inside the downloaded install.ps1






                  share|improve this answer














                  See https://github.com/chocolatey/chocolatey/wiki/Proxy-Settings-for-Chocolatey



                  In powershell define the function



                  function Create-Proxy($proxyHost,$proxyPort,$proxyUsername,$proxyPassword){
                  #$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
                  $proxyUrl = $proxyHost+":"+$proxyPort;
                  Write-Host "proxy url [$proxyUrl]";
                  $proxy = New-Object System.Net.WebProxy($proxyUrl, $true);
                  $passwd = ConvertTo-SecureString $proxyPassword -AsPlainText -Force; ## Website credentials
                  $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($proxyUsername, $passwd);
                  return $proxy;
                  }


                  call it like



                  $wc=new-object net.webclient;
                  $wc.UseDefaultCredentials = $true
                  $wc.Proxy = Create-Proxy "<proxy-host>" "<proxy-port>" "<proxy-username>" "<proxy-clear-pass>"
                  $wc.DownloadString('https://chocolatey.org/install.ps1');




                  What I discovered is that the actual download worked, but the execution of the installer didn't since it used a custom constructed proxy.



                  So the iex ($wc.DownloadString("https://chocolatey.org/install.ps1")); fails because the bad proxy configuration inside the downloaded install.ps1







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 14 '15 at 14:36

























                  answered Sep 14 '15 at 11:22









                  raisercostin

                  1881210




                  1881210























                      0














                      You can use this. Worked for me.
                      https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey



                      Explicit Proxy Settings



                      Chocolatey has explicit proxy support starting with 0.9.9.9.



                      You can simply configure 1 or 3 settings and Chocolatey will use a proxy server. proxy is required and is the location and port of the proxy server. proxyUser and proxyPassword are optional. The values for user/password are only used for credentials when both are present.



                      choco config set proxy <locationandport>
                      choco config set proxyUser <username>
                      choco config set proxyPassword <passwordThatGetsEncryptedInFile>


                      Example



                      Running the following commands in 0.9.9.9:



                      choco config set proxy http://localhost:8888
                      choco config set proxyUser bob
                      choco config set proxyPassword 123Sup#rSecur3





                      share|improve this answer





















                      • This answer explains how to configure Chocolatey to use a proxy. The question asks how to install Chocolatey from behind a proxy. This answer will be useful after that, but it's not what the question was asking.
                        – anaximander
                        May 18 '17 at 12:21
















                      0














                      You can use this. Worked for me.
                      https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey



                      Explicit Proxy Settings



                      Chocolatey has explicit proxy support starting with 0.9.9.9.



                      You can simply configure 1 or 3 settings and Chocolatey will use a proxy server. proxy is required and is the location and port of the proxy server. proxyUser and proxyPassword are optional. The values for user/password are only used for credentials when both are present.



                      choco config set proxy <locationandport>
                      choco config set proxyUser <username>
                      choco config set proxyPassword <passwordThatGetsEncryptedInFile>


                      Example



                      Running the following commands in 0.9.9.9:



                      choco config set proxy http://localhost:8888
                      choco config set proxyUser bob
                      choco config set proxyPassword 123Sup#rSecur3





                      share|improve this answer





















                      • This answer explains how to configure Chocolatey to use a proxy. The question asks how to install Chocolatey from behind a proxy. This answer will be useful after that, but it's not what the question was asking.
                        – anaximander
                        May 18 '17 at 12:21














                      0












                      0








                      0






                      You can use this. Worked for me.
                      https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey



                      Explicit Proxy Settings



                      Chocolatey has explicit proxy support starting with 0.9.9.9.



                      You can simply configure 1 or 3 settings and Chocolatey will use a proxy server. proxy is required and is the location and port of the proxy server. proxyUser and proxyPassword are optional. The values for user/password are only used for credentials when both are present.



                      choco config set proxy <locationandport>
                      choco config set proxyUser <username>
                      choco config set proxyPassword <passwordThatGetsEncryptedInFile>


                      Example



                      Running the following commands in 0.9.9.9:



                      choco config set proxy http://localhost:8888
                      choco config set proxyUser bob
                      choco config set proxyPassword 123Sup#rSecur3





                      share|improve this answer












                      You can use this. Worked for me.
                      https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey



                      Explicit Proxy Settings



                      Chocolatey has explicit proxy support starting with 0.9.9.9.



                      You can simply configure 1 or 3 settings and Chocolatey will use a proxy server. proxy is required and is the location and port of the proxy server. proxyUser and proxyPassword are optional. The values for user/password are only used for credentials when both are present.



                      choco config set proxy <locationandport>
                      choco config set proxyUser <username>
                      choco config set proxyPassword <passwordThatGetsEncryptedInFile>


                      Example



                      Running the following commands in 0.9.9.9:



                      choco config set proxy http://localhost:8888
                      choco config set proxyUser bob
                      choco config set proxyPassword 123Sup#rSecur3






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Oct 29 '16 at 17:05









                      fraballi

                      1012




                      1012












                      • This answer explains how to configure Chocolatey to use a proxy. The question asks how to install Chocolatey from behind a proxy. This answer will be useful after that, but it's not what the question was asking.
                        – anaximander
                        May 18 '17 at 12:21


















                      • This answer explains how to configure Chocolatey to use a proxy. The question asks how to install Chocolatey from behind a proxy. This answer will be useful after that, but it's not what the question was asking.
                        – anaximander
                        May 18 '17 at 12:21
















                      This answer explains how to configure Chocolatey to use a proxy. The question asks how to install Chocolatey from behind a proxy. This answer will be useful after that, but it's not what the question was asking.
                      – anaximander
                      May 18 '17 at 12:21




                      This answer explains how to configure Chocolatey to use a proxy. The question asks how to install Chocolatey from behind a proxy. This answer will be useful after that, but it's not what the question was asking.
                      – anaximander
                      May 18 '17 at 12:21


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f971103%2fproxy-configuration-in-powershell%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Plaza Victoria

                      Puebla de Zaragoza

                      Musa