ICS stops working after a reboot

There are numerous reports (first, second, third results on Google) on the Internet about an issue with Internet Connection Sharing in Windows 10. Since the 1607 release (or 1703 for some people) ICS stops working after a reboot. The only way to get it working again for me was to disable and then re-enable the sharing. Resetting Windows Firewall settings, suggested by some people, didn’t work.

You can automate the disable/enable steps with a simple Powershell script run as a scheduled task on system startup, like this one:

$m = New-Object -ComObject HNetCfg.HNetShare

$private = $m.EnumEveryConnection |? { $m.NetConnectionProps.Invoke($_).Name -eq "Loopback0" }
$private_config = $m.INetSharingConfigurationForINetConnection.Invoke($private)

$public = $m.EnumEveryConnection |? { $m.NetConnectionProps.Invoke($_).Name -eq "Wi-Fi" }
$public_config = $m.INetSharingConfigurationForINetConnection.Invoke($public)

$private_config.DisableSharing()
$public_config.DisableSharing()

Start-Sleep 1

$public_config.EnableSharing(0)
$private_config.EnableSharing(1)

if you’re after a quick and easy fix. Some users reported Windows Firewall filling up with duplicate rules created on every enable/disable of the ICS though.

There is a better fix, however.

Dissatisfied with all proposed workarounds I’ve tried searching for the reports on this issue on Microsoft TechNet directly. The issue has been there for years, so there are plenty.

One thread mentioned creating the DWORD HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\SharedAccess\EnableRebootPersistConnection registry key, setting it to 1 and setting the Internet Connection Sharing service startup type to “Automatic”. This fixed the problem!

The mentioned registry key was introduced with the 1709 release in KB4054517. See KB4055559 for more information.