2

I'm trying to do the following tasks:

  • Connect to a remote computer through Powershell ISE 4
  • Then run a ps1 script in that computer, that installs chocolatey and update other software

This machine is set to the corporate proxy server which is very sassy when I try to authenticate. Since I have a Squid in a lab environment connected to our DMZ, I wanted to use this proxy while I install stuff on this PC. No authentication required. :-)

  • I could set my Squid proxy on this remote machine via Powershell
  • Tried to run my .ps1 script to install chocolatey and get error message:

"The remote server returned an error: (407) Proxy Authentication Required."

This driving me nuts. I'm sure I'm missing something here, since I really believe that as long as I have changed the proxy that doesn't need authentication, I was good to go. I have checked this pc graphically and the Squid proxy is all set there.

Can you please give some hint on what I'm screwing up?

SarsaJP
  • 23
  • 4
  • Welcome to Server Fault! You make it sound like you should enlist the aid of your sysadmins, so as not to break company policies. – ErikE Sep 05 '15 at 20:18
  • Thank you for the tip. I'm one of them, and we have some flexibility for testing. This is a test ennvironment. Back to the issue, we noted that if we do remote desktop to that computer and acessing Windows internet options, then navigating to connection options, Powershell remote never asks for authentication on our Squid. Which is odd. I think when we access internet options and then click on ok, something changes allowing us to work with that proxy that has been changed via Powershell. – SarsaJP Sep 06 '15 at 08:27

1 Answers1

0

There is a workaround:

  1. You login with some credentials to your server (ideally a service account)
  2. You configure proxy in the server (Not sure if machine.config or internet explorer settings)
  3. You can execute remote command (Invoke-Command) using -Credential parameter, using that service account. The Powershell command will have those credentials
Oscar Foley
  • 332
  • 4
  • 18