In Part 1 of this series I discussed the tools used to configure WinHttp today and introduced the changes happening for Windows Vista. In this post I’m looking at the Proxy settings. Again as a reminder, this is how it is for Windows Vista Beta 2 and it is likely to change some before Vista RTM.

After running netsh and going to the winhttp context, we switch to the proxy context by typing “proxy”:

netsh winhttp> proxy

netsh winhttp proxy>

     

Here is the list of available commands in that context:

netsh winhttp proxy>?

     

The following commands are available:

     

… (Skipping the inherited commands …)

     

Commands in this context:

?              - Displays a list of commands.

dump           - Displays a configuration script.

help           - Displays a list of commands.

import         - Imports proxy setting from IE.

reset          - Resets WinHTTP proxy setting to DIRECT.

set            - Configures WinHTTP proxy setting.

show           - Displays current WinHTTP proxy setting.

     

You can use “show” to view the current settings, “set” to set the proxy settings and “import” to import current user’s Internet Explorer proxy settings. If you’ve used proxycfg.exe you will find that this context provides the same functionality. The only exception is “dump”, which creates a Netsh script with the current settings and can be executed later (on the same machine or different one) to set those settings.

Let’s start by displaying the current proxy settings:

netsh winhttp proxy>show

     

Current WinHTTP proxy settings:

     

    Direct access (no proxy server).

     

Now let’s set the proxy server for HTTP sites to “myproxy” (port 80 by default), proxy server for HTTPS sites to “sproxy” (port 88) and set the bypass list to “*.foo.com”:

netsh winhttp proxy>set proxy-server="http=myproxy;https=sproxy:88" bypass-list=

"*.foo.com"

   

Current WinHTTP proxy settings:

   

Proxy Server(s) : http=myproxy;https=sproxy:88

Bypass List : *.foo.com

   

To reset the proxy settings to “direct” (not to use proxy servers), just type “reset”:

netsh winhttp proxy>reset

   

Current WinHTTP proxy settings:

   

Direct access (no proxy server).

   

Another useful command is to import the proxy settings for the current user in Internet Explorer (note that different users may specify different proxy settings in IE):

Current WinHTTP proxy settings:

   

Proxy Server(s) : ieproxy:80

Bypass List : <local>

   

Again, if you need to get a help on a command, just type it with question mark after it.

Next time I will go into a bit more detail about tracing configuration.

 --Nesho Neshev