How can ICS in Windows 7 be managed without the GUI?

2

1

I've been using ICS successfully for years, but now I'm looking for a way to control it through something else than the GUI in Control Panel\Network and Internet\Network Connections -> Connection Properties:

I basically want to manually do what this checkbox does

I want to do everything that the encircled checkbox does and more, without touching any GUI. This leads me to the following subquestion:

What does the checkbox do?
Microsoft don't provide specific information and the most helpful forum post I've found is from 2003. Assuming that some of the advice is still valid, I've come to the conclusion that ICS is broken down into 6 parts that have to be set up individually:

  1. the sharedAccess service
  2. interface settings
  3. firewall rules
  4. a static route
  5. dnsproxy
  6. autodhcp

I've already learned that the service can be started/stopped with the command net start/stop sharedAccess and that netsh is a good tool for changing the interface settings and the firewall rules. But I don't understand how ICS handles routing and DNS. All hosts in my network are configured statically, so I don't care much about autodhcp.

Thanks for your help!


EDIT: I spent a day following Randolph West's advice and analyzed the output in ProcMon. I saw reads and writes to both the registry and the filesystem, and it was too difficult for me to understand what exactly it all meant - except that an API was being called.

Skya

Posted 2012-03-26T01:13:45.620

Reputation: 80

1Use Process Monitor from sysinternals.com to see exactly what it's doing, and then use whatever methods available to script that out. You'll probably find a lot of it is related to the registry, which ProcMon will see. – None – 2012-03-26T07:29:43.253

Answers

2

I decided to dig into the Windows API for a solution and found this, the interface which controls the encircled button! Everything else can be controlled with netsh. I wrote a simple C++ utility that lets me start/stop ICS between two network adapters, set the scope for the "DNS server IN" firewall rule and set the IP address of the LAN interface. This is all I needed and I don't think there's any other way to do it.

I've uploaded my solution to sourceforge: https://sourceforge.net/p/icsctrl/

Skya

Posted 2012-03-26T01:13:45.620

Reputation: 80

Skya, could you expand on how to use your utility I don't see how you can enable ICS since its not detecting my adapters. Right now i'm using a desktop with a wifi card that is connected to a router via ethernet. I have the desktop wifi card setup as an access point with the desktop's internet connection shared with the wifi access point so other users can go online via the Microsoft Hosted Network Virtual Adapter. Is there anyway to see the DHCP client table for that access point? I would like to see all connected users to this AP. – None – 2013-03-05T16:37:06.090