As a followup to
my post in Techoff, this is a C# port of the script that jandvries pointed me to. It is used to enable or disable a network connection in the same way the shell does it when you select the relevant option from the Network Connections folder in the Control Panel.
It is a command line application, run it without any arguments to see usage information.
If you run a localized (non-English) version of Windows, you should modify the ToggleNic.exe.config file to specify the correct names of the Network Connections folder and the enable and disable verbs.
It should work under Windows 2000 and up, although under 2000 you need to change the name of the Network Connections folder in ToggleNic.exe.config.