0

I work at a datacenter and work on servers in various global locations. We have about 10 proxy servers and no good way to know which proxy server to use on which server/domain/vlan ect... Don't ask why as I have and have been told "go ask security". Anyhow I wanted to use a batch script to telnet to each proxy server on port 8080. I have the proxy server's IP addresses and know they're listening on 8080. How could I from a script check one by one and come back with a response?

Hope this makes sense. At this time I have to go into internet settings -> connection -> proxies and try one by one. And these are windows 03 & 08 servers.

Any help is greatly appreciated!

To clarify. I'm looking for a script that will go through a list of known proxies and ports and verify connectivity.

Got the following error with the powershell script enter image description here

shaiss
  • 337
  • 2
  • 6
  • 20

2 Answers2

3

I would use some other command line tool like wget instead. These will be much more easily batched. wget is not designed to make requests directly to proxies, but you'll still get a response from the proxy (probably a 502 or something) which is all you need given your requirements.

wget myproxy1:8080
wget myproxy2:8080
wget myproxy3:8080
...

You'll get some kind of HTTP response out of the ones that are responding and a connection timeout for the ones that aren't.

EDIT:
Here's something using Powershell:

$proxyArray = @("proxy1.mynet.com:8080","proxy2.mynet.com:8080")
foreach ($proxy in $proxyArray) {
  $httpRequest = [System.Net.WebRequest]::Create("http://www.google.com")
  $httpRequest.Proxy = new-object -typename System.Net.WebProxy -argumentlist $proxy
  $httpRequest.GetResponse()
}

Using that you'll get some kind of HTTP response out of the proxies that are listening, a connection timeout, or host not found / name resolution error.

squillman
  • 37,618
  • 10
  • 90
  • 145
0

Configure proxy.pac on your clients. Look at this link will explain how to set it up. http://en.wikipedia.org/wiki/Proxy_auto-config

HTH

Mihai
  • 51
  • 1
  • A client will not loop through all of the proxies in the return list. If the first proxy in the return list answers then the browser uses that one and ignores the rest. – squillman Jan 23 '11 at 14:34
  • Different clients in our network have access to different proxies. That's why I need a simple script or a portable app. – shaiss Jan 27 '11 at 19:56