Downloads
22922.zip

\[Editor's Note: Because of space, the listings are abbreviated. To obtain the complete listings, with remarks, go to http:// www.win2000mag.com/articles and enter the InstantDoc ID number in the InstantDoc ID text box.\]

I recently had a problem with laptop configurations on my organization's network. We have an internal network behind a proxy server. Laptop users use Microsoft Proxy Server 2.0's client software, Winsock Proxy, to connect to the Internet while on the internal network. When users traveled, they had problems browsing the Internet and sending and receiving email. I tried to teach users to disable the proxy client from the Control Panel applet, then reboot and dial their ISP. Some users seemed unable to follow these instructions.

I knew the Control Panel applet must affect a configuration file or registry entry, so I used Sysinternals' Regmon and Filemon tools to look for the configuration change. I discovered that the file win.ini contains the applicable proxy information. By default, win.ini contains no proxy-related entries after you install the client software. However, when you disable the proxy client from the Control Panel applet the first time, the system creates the following entry in the win.ini file:

\[Microsoft Proxy Service\]
Disable=1

When you disable the proxy client, the entry in the Microsoft Proxy Service section sets to Disable=1.

Once I knew where the configuration change took place, I needed to create a script to determine whether the computer was connected to the network and, if so, to enable the proxy client. If the computer wasn't connected to the network, I needed to determine whether the proxy client was disabled. If the proxy client was disabled, I wanted to keep the current configuration. If the client wasn't disabled, I wanted to modify the win.ini file. I created the script in Listing 1 to accomplish these tasks. Although I could have used some of Microsoft's .ini editing tools, I used the KISS (Keep It Simple, Stupid) method instead.

For the script in Listing 1 to work, you must install the proxy client on the laptop, use the Control Panel applet to disable the proxy client, close the proxy client, then reenable the proxy client. These actions add the Microsoft Proxy Service entry in the win.ini file and set the win.ini file for the LAN configuration.

Finally, I ran the setup script in Listing 2 from a network share to install the scripts on the laptops. Listing 3 contains the wininichg.reg file to set the script in Listing 1 to run at logon.