Fixing Windows 10 Version 1607 Internet Sharing

Note that this bug appears to have been fixed in the now current release of Windows 10 (1709, Fall Creators Update, including build 16299). The script below also no longer works in this form.

Since Internet Sharing stops working after a reboot (not just during) with the current version of Windows 10, a Scheduled Task is necessary to restart Internet Sharing at boot.

Use this script to start Internet Sharing.


if (!$sPrivateAdapterName) {
"EnableSharing.ps1 sPublicAdapterName sPrivateAdapterName"

# Constants
$public = 0
$private = 1

Write-Host "Creating netshare object..."
$netshare = New-Object -ComObject HNetCfg.HNetShare

Write-Host "Getting public adapter..."
$publicprops = $netshare.EnumEveryConnection | Where-Object {
$netshare.NetConnectionProps($_).Name -eq $sPublicAdapterName
$publicadapter = $netshare.INetSharingConfigurationForINetConnection($publicprops)
$publicadapter | more

Write-Host "Getting private adapter..."
$privateprops = $netshare.EnumEveryConnection | Where-Object {
$netshare.NetConnectionProps($_).Name -eq $sPrivateAdapterName
$privateadapter = $netshare.INetSharingConfigurationForINetConnection($privateprops)
$privateadapter | more

Write-Host "Disabling public sharing for public adapter..."
$publicadapter | more

Write-Host "Disabling private sharing for private adapter..."
$privateadapter | more

Write-Host "Enabling public sharing for public adapter...."
$publicadapter | more

Write-Host "Enabling private sharing for private adapter...."
$privateadapter | more

# Clean up
Remove-Variable netshare

End script. Note that the exact order of disabling and enabling sharing does matter. (Trust me.)

Make sure your adapter names do not contain brackets or, possibly, other special characters. (Rename them if necessary.)

Use a batch file containing the below line to start it from the Task Scheduler.

powershell.exe -Command c:\Windows\Scripts\EnableSharing.ps1 PublicAdapter PrivateAdapter

PublicAdapter and PrivateAdapter are the two adapters. (PublicAdapter is the one connected to the Internet. PrivateAdapter is the one connected to your network.)

 © Andrew Brehm 2016