Wednesday, April 06, 2011

ADFS : Setting up a proxy

The instructions on Things to Check Before Troubleshooting AD FS 2.0 specify using proxycfg to change the proxy settings.

However, on Windows 2008 Server R2, this has been deprecated and you need to use Netsh.

Open a command prompt. You need to run as administrator.


C:\>netsh /?

Usage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]Use
rName] [-p Password | *]
[Command | -f ScriptFile]

The following commands are available:

Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a list of entries.
advfirewall - Changes to the `netsh advfirewall' context.
branchcache - Changes to the `netsh branchcache' context.
bridge - Changes to the `netsh bridge' context.
delete - Deletes a configuration entry from a list of entries.
dhcpclient - Changes to the `netsh dhcpclient' context.
dnsclient - Changes to the `netsh dnsclient' context.
dump - Displays a configuration script.
exec - Runs a script file.
firewall - Changes to the `netsh firewall' context.
help - Displays a list of commands.
http - Changes to the `netsh http' context.
interface - Changes to the `netsh interface' context.
ipsec - Changes to the `netsh ipsec' context.
lan - Changes to the `netsh lan' context.
mbn - Changes to the `netsh mbn' context.
namespace - Changes to the `netsh namespace' context.
nap - Changes to the `netsh nap' context.
netio - Changes to the `netsh netio' context.
p2p - Changes to the `netsh p2p' context.
ras - Changes to the `netsh ras' context.
rpc - Changes to the `netsh rpc' context.
set - Updates configuration settings.
show - Displays information.
trace - Changes to the `netsh trace' context.
wcn - Changes to the `netsh wcn' context.
wfp - Changes to the `netsh wfp' context.
winhttp - Changes to the `netsh winhttp' context.
winsock - Changes to the `netsh winsock' context.
wlan - Changes to the `netsh wlan' context.

The following sub-contexts are available:
advfirewall branchcache bridge dhcpclient dnsclient firewall http interface ips
ec lan mbn namespace nap netio p2p ras rpc trace wcn wfp winhttp winsock wlan

To view help for a command, type the command, followed by a space, and then type ?.


We want the winhttp option:


C:\>netsh winhttp /?

The following commands are available:

Commands in this context:
? - Displays a list of commands.
dump - Displays a configuration script.
help - Displays a list of commands.
import - Imports WinHTTP proxy settings.
reset - Resets WinHTTP settings.
set - Configures WinHTTP settings.
show - Displays currents settings.

To view help for a command, type the command, followed by a space, and then type ?



To see the current proxy, use:


C:\>netsh winhttp show proxy

Current WinHTTP proxy settings:

Direct access (no proxy server).


To set the proxy, use:


C:\>netsh winhttp set proxy /?

Usage: set proxy [proxy-server=] [bypass-list=]

Parameters:

Tag Value
proxy-server - proxy server for use for http and/or https protocol
bypass-list - a list of sites that should be visited bypassing the
proxy (use "" to bypass all short name hosts)

Examples:

set proxy myproxy
set proxy myproxy:80 ";bar"
set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*.foo.com"


Enjoy!

No comments: