windows icon indicating copy to clipboard operation
windows copied to clipboard

[Question]: Windows Networks Prompt

Open deuts opened this issue 1 year ago • 10 comments

Is your question not already answered in the FAQ?

  • [X] I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • [X] I am sure my question is not about a technical issue.

Question

I have installed Windows 10 in a Docker container using this image. I connect to my Windows VM via Remmina. However, every time I launch Windows, this Networks always prompt and the name continues to go up by 1.

image

Any way I can disable this? It's not so much of an issue, but I just find it annoying.

Thanks.

deuts avatar Jul 14 '24 04:07 deuts

https://superuser.com/questions/1214281/how-to-hide-or-disable-allow-pc-to-be-discoverable-on-this-network

gordoncheong avatar Jul 14 '24 15:07 gordoncheong

This workaround unfortunately will likely only mask the problem as it does not solve the potential for hundreds of NIC & network junk entries being added over time to the registry. To me this needs a more elegant solution.

itiligent avatar Jul 25 '24 07:07 itiligent

Any update for this?

laye0619 avatar Aug 31 '24 01:08 laye0619

If using a macvlan there is no issue, I've fiddled about with this and not got far too far, but I suspect the solution will involve stepping away from the default bridge in docker and assinging a set mac address to a manually created bridge. It's a bit annoying !

itiligent avatar Aug 31 '24 02:08 itiligent

Actually, this issue is still there even if using macvlan. BTW, my OS is win server 2012.

laye0619 avatar Aug 31 '24 13:08 laye0619

The network number is unlimited, right?

laye0619 avatar Aug 31 '24 13:08 laye0619

I've come up with a fairly reasonable workaround for any network:

  1. Stop the annoying prompt by adding this key: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff]

  2. Set the below powershell script to run as a task at boot to keep the network profiles tidy (you will need to adapt it if you have multiple virutal NICs. It will remove any unused profiles and set the current network adatper name to "WinApps" or whatever else you might like

# Get the current network profile name
$currentProfile = (Get-NetConnectionProfile).Name

# Get all profiles from the registry
$profilesKey = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles"
$profiles = Get-ChildItem -Path $profilesKey

foreach ($profile in $profiles) {
    $profilePath = "$profilesKey\$($profile.PSChildName)"
    $profileName = (Get-ItemProperty -Path $profilePath).ProfileName

    # Remove profiles that don't match the current one
    if ($profileName -ne $currentProfile) {
        Remove-Item -Path $profilePath -Recurse
        Write-Host "Deleted profile: $profileName"
    }
}

# Change the current profile name to "WinApps"
$profiles = Get-ChildItem -Path $profilesKey
foreach ($profile in $profiles) {
    $profilePath = "$profilesKey\$($profile.PSChildName)"
    $profileName = (Get-ItemProperty -Path $profilePath).ProfileName

    if ($profileName -eq $currentProfile) {
        # Update the profile name
        Set-ItemProperty -Path $profilePath -Name "ProfileName" -Value "WinApps"
        Write-Host "Renamed profile to: WinApps"
    }
}

itiligent avatar Sep 16 '24 16:09 itiligent

Can anyone who experiences this issue confirm wether the MAC address of the network adapter stays the same when the number goes up? Because it should not change. And if the PCI slot for the adaptor stays the same? I can only fix this if I know what changes

kroese avatar Oct 14 '24 02:10 kroese

Can anyone who experiences this issue confirm wether the MAC address of the network adapter stays the same when the number goes up? Because it should not change. And if the PCI slot for the adaptor stays the same? I can only fix this if I know what changes

Yes, the MAC address stays same when the number goes up...

laye0619 avatar Oct 14 '24 12:10 laye0619

Okay, then it must be something else that changes. Maybe the PCI bus or something like that.

kroese avatar Oct 14 '24 12:10 kroese

I have this problem with both Windows 10 and Windows 11. The only difference is that Windows 11 seems to suppress the message by default.

The PCI bus location doesn't seem to change either.

The only thing that changes in the network profiles (apart from the name) is a value labelled "DefaultGatewayMac" which exists in a different registry location to that referenced in itelligent's script. The locations are linked by a common "ProfileGuid" value.

Below is a sample of the entire registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged\010103000F0000F0080000000F0000F03A188AA27D7177C2DD99519D3D8319B23615008340D4DFDA5F16DACC9B3EF1A9] "ProfileGuid"="{4D3697E5-D5E6-4957-88C8-944F18316D66}" "Description"="Network 13" "Source"=dword:00000008 "DnsSuffix"="" "FirstNetwork"="Network 13" "DefaultGatewayMac"=hex:16,e8,14,7f,af,20

So what we appear to have is the MAC address of the gateway changing although all the IP addresses (machine, gateway and DNS etc.) all stay the same. Presumably Windows is noticing the gateway mac address changing and is assuming the machine has changed networks. It's a reasonable assumption I guess.

It's probably worth mentioning that I am doing a manual install using a custom iso. It might be worth asking whether others are doing something similar.

Hope this helps. In the meantime I am going to work around the problem using my own adaptation of itelligent's script.

Many thanks for this project. It really is excellent work.

JOH451 avatar Feb 24 '25 00:02 JOH451

@JOH451 Thank you so much for your research. Since you discovered it was related to the random gateway MAC, I managed to fix the issue by setting the MAC to a static value: https://github.com/qemus/qemu-docker/pull/650/files

So the problem will be solved in the next version, and the script is not necessary anymore.

kroese avatar Feb 24 '25 02:02 kroese

This is now fixed in v4.13. After launching that version it will detect a new network one more time, and after that it will always keep the same network.

kroese avatar Feb 24 '25 03:02 kroese