We need an Internal Switch for Hyper-V, Private!

Here is how you create an internal switch for Hyper-V, share the Internet connection of your WLAN adapter, and configure the internal switch as a "private network" so the Windows firewall doesn't keep blocking you from accessing it.

As usual with Windows, it is quite easy to do this.

First in Hyper-V Manager, click on "Virtual Switch Manager" and create a virtual switch of the "Internal nework" persuasion.


Then find the (physical) WiFi adapter and configure it to share the Internet connection.


Third realise that the virtual switch is represented in the root partition (i.e. your Windows OS) as an "Unidentified network" and, as if that weren't bad enough, a "Public network".


This of course triggers Windows, which is highly xenophobic, to treat this new, internal, network differently and discriminate against it.

In the spirit of equality, the network should become a "Private network" but this cannot easily be done.

You can follow this tutorial, which shows you how to make any unidentified network a "Private network".

But you probably don't want to declare any unidentified network part of your trusted environment.

The problem is, even if you do manage to set the internal switch network "Private", it won't be that any more after a reboot. (Maybe this is because it doesn't belong to Windows but is rebuilt by Hyper-V before Windows boots every time the computer starts. I don't know.)

Use PowerShell's


to show your network adapters and their category.

And you can use PowerShell's

Set-NetConnectionProfile -InterfaceAlias "vEthernet (WLAN)" -NetworkCategory Private

to set the network "Private" for this session.

To do this every time the computer starts, configure a scheduled task for a PowerShell script.

This is the PowerShell script you want. It configures all virtual Ethernet network adapters to register as "Private network".

$log = $Env:TEMP
$log += "\SetInternalPrivate.log"
New-Item -ItemType "File" $log -Force
Get-Date | Out-File $log -Append
Import-Module NetConnection
Get-Module | Out-File $log -Append
$profiles = Get-NetConnectionProfile | Where-Object {$_.InterfaceAlias -like "vEthernet*"}
$profiles | ForEach-Object {$_ | Set-NetConnectionProfile -NetworkCategory "Private"}
$profiles | Out-File $log -Append

Then create a batch file to start the script.

powershell.exe -Command c:\Windows\Scripts\SetInternalPrivate.ps1

You probably shouldn't be keeping scripts in c:\Windows\Scripts. I am doing it here because I am a daredevil.


Then create a scheduled task for this batch file to start 1 minute after startup.


Configure to run the task as user System. The log files will then (most likely) be in c:\System\Temp.

The script will turn this:


into that:


And that's probably what you wanted.

 © Andrew Brehm 2016