WlanGetNetworkBssList Error when trying to auto switch / Bug Reports / NetSetMan Support

NetSetMan Support

Search for already answered questions about NetSetMan (Pro) or ask new ones

You are not logged in.

#1 2021-03-13 17:09

touriga
Member
Registered: 2021-03-05
Posts: 7

WlanGetNetworkBssList Error when trying to auto switch

Hi, Any ideas?
I've been using NetSetMan for almost a year without problems.  In the last 2 weeks I've been receiving an error when it tries to auto switch to a different WiFi AP.

"WlanGetNetworkBssList Error: 1168 Element not found"

The switching is unsuccessful and it then keeps trying to switch each time throwing the error.

If I don't dismiss the error windows they keep building up.  It then also presents an error:
"System error. Code: 6. The handle is invalid.

NSM_error-Phone.png

NetSetMan version: 5.0.5
Released: 2021-02-04
OS: Windows 10 (10.0.19042 Build 19042)
Network Adapter: ASUS PCE-AC88
WiFi: ASUS AIMesh network. Router: RT-AC86U, 1 x Node: RT-AC86U

Last edited by touriga (2021-03-13 17:15)

Offline

#2 2021-03-13 22:53

NetSetMan Support
Administrator
Registered: 2005-08-06
Posts: 1,878

Re: WlanGetNetworkBssList Error when trying to auto switch

Please describe in detail what you mean by "when it tries to auto switch to a different WiFi AP". The WiFi Management shown in your screenshot does not automatically switch to any wireless networks, so describe exactly the steps you are performing prior to this error.

Offline

#3 2021-03-16 11:05

touriga
Member
Registered: 2021-03-05
Posts: 7

Re: WlanGetNetworkBssList Error when trying to auto switch

Hi, thanks for your response.
The mesh network I described above results in 4 x MAC addresses being available:
- 2.4GHz Router
- 5GHz Router
- 2.4GHz Node
- 5GHz Node

All on the same SSID.

NetSetMan has been fantastic in automatically forcing my PC and laptops to switch to the strongest signal if the relative strengths between the 4 available connections changes.

This happens in the background without me having to do anything.  Recently however, I have been getting the errors described pop up on the screen and on investigation it was happening whenever NetSetMan was trying to switch from a connection that had deteriorated to one of the other 3 that were now a stronger signal.

The error effectively prevents the switching from the weaker signal to the stronger one.  It seems that NetSetMan has a polling frequency whereby it monitors the relative signal strengths on a regular basis. Therefore when the next check is done it again tries to switch only to encounter the same error again. The error messages accumulate if I don't dismiss them by pressing "OK".

Switching to the strongest signal manually in NetSetMan works perfectly.

It seems that NetSetMan uses the WlanGetNetworkBssList function to retrieve the basic service set entries of the wireless network(s) on the wireless interface.  The applicable error is:

ERROR_NOT_FOUND  :  The element was not found. This error is returned if the GUID of the interface to be queried that was specified in the pInterfaceGuid parameter could not be found.

This may indicate that the interface GUID on my PC and that issued by NetSetMan in the function call differ.

WlanGetNetworkBssList function (wlanapi.h)

I can recreate the error if, using NetSetMan, I manually switch to one of the connections that is significantly weaker.  NetSetMan then immediately tries to switch back to the stronger connection and issues the error.  It will keep issuing the error every 20 - 30 seconds each time it re-polls, until I manually switch it back to the strongest connection.

I have made a video of this behaviour and am happy to share it privately.

Offline

#4 2021-03-17 21:14

NetSetMan Support
Administrator
Registered: 2005-08-06
Posts: 1,878

Re: WlanGetNetworkBssList Error when trying to auto switch

touriga wrote:

It seems that NetSetMan has a polling frequency whereby it monitors the relative signal strengths on a regular basis.

It is not relevant for finding a solution, be want just to clarify, that NetSetMan is not actively polling but listening to certain WiFi events. Whenever Windows or the wireless network adapter driver populate relevant changes, NetSetMan reacts to that. This is much more resource friendly than constantly reading data for no reason.

touriga wrote:

ERROR_NOT_FOUND  :  The element was not found. This error is returned if the GUID of the interface to be queried that was specified in the pInterfaceGuid parameter could not be found.

This may indicate that the interface GUID on my PC and that issued by NetSetMan in the function call differ.

Based on your screenshot, you have more than one WiFi network adapter. Maybe this is somehow leading to this problem, because they get mixed up for some reason. Would you mind disabling one of them completely in the Windows Network Connections? Then restart NetSetMan and try again. Try narrowing it down as good as you can. Then we can start working on the issue based on your results.

Offline

#5 2021-03-18 22:31

touriga
Member
Registered: 2021-03-05
Posts: 7

Re: WlanGetNetworkBssList Error when trying to auto switch

Hi
I do indeed have 2 WiFi adapters: the original onboard one (AC-7600) and newer one (PC-88).  Although I left the AC-7600 physically installed I have had it disabled ever since I installed the PC-88.  I want it available in case I ever need to remove the PC-88 which has an external antenna.

i.e. The AC-7600 appeared as a network adapter, but disabled (greyed out).

NetSetMan does not seem to have worried about this until recently, but you are correct it is now trying to interact with the (disabled) adapter during auto switch events.

As a test I enable the AC-7600 and the error no longer occurred.  However, this threw up other problems and was not a workable solution.

I tried uninstalling the adapter in Device Manager, but Windows just reinstalls it automatically.

Fortunately there is simple fix for that - disable automatic driver installation - as long as I remember to re-enable it temporarily when I need it.
Disable_Automatic_Device_Installation2.png

The AC-7600 adapter no longer shows in Device Manager nor in Network Adapters. All seems to be ok now and after re-starting NetScanMan it also disappeared from there.  Auto Switch seems to working again without a problem.

Thanks for the help

Offline

#6 2021-03-18 22:42

NetSetMan Support
Administrator
Registered: 2005-08-06
Posts: 1,878

Re: WlanGetNetworkBssList Error when trying to auto switch

Interesting, glad to hear you found a workaround!
Based on your additional description, it seems that the strongest-signal-switcher uses the first available WiFi NIC (even if disabled) instead of the one that is actually currently connected to that network. If that's the case, then this should be fixable. We will analyze this.
Thanks for analyzing this and sharing your temporary solution.

Offline

#7 2021-03-26 16:37

touriga
Member
Registered: 2021-03-05
Posts: 7

Re: WlanGetNetworkBssList Error when trying to auto switch

Update ...

It seems that the "disable automatic driver installation" setting is not master of the computer universe.  At reboot my unwanted on-board WiFi adapter is re-installed, causing havoc with my connection.

"Why don't you just disconnect it physically?", I hear you ask.  Good question, and I will be doing so as soon as I have time and an excuse to extract my computer from its rather permanent, cable-encrusted spot under my desk.

In the mean time I needed a quick way to send the on-board adapter back into its virtual box.

The batch file below rips out the adapter from the Registry.  This is simply what uninstalling it via Device Manager appears to do (possibly along with other actions, but it seems to do no harm).
Fortunately, whenever it gets reinstalled it occupies the same slot so the subkey ("0002" in my case) that I need to delete is always the same.

Big Disclaimer: Mess with your Registry at your own risk.  If you happen to do something similar I would suggest you carefully observe how the Registry is changed as you uninstall and reinstall a device with Device Manager before you start issuing "reg delete" commands.

@echo off
echo **********************************************************
echo *  Delete Registry key for AC7260 on-board WiFi adapter  *
echo **********************************************************
echo Confirming NetSetMan Running ...
tasklist /FI "IMAGENAME eq netsetman.exe"
tasklist /FI "IMAGENAME eq nsmservice.exe" /NH
echo Closing NetSetMan ...
taskkill /IM netsetman.exe /F
rem echo Stopping NetSetMan Service ...
rem net stop nsmService
echo Uninstall AC7260 ...
reg delete HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0002 /f
rem echo Starting NetSetMan Service ...
rem net start nsmService
echo Starting NetSetMan ...
path=%path%;C:\Program Files (x86)\NetSetMan\
start "" netsetman.exe -h

This batch file needs to run in Administrator mode so I simply created a shortcut to it, set the short cut to "Run as Administrator" and stuck it on the Start menu so I can run it any time I want.

I stop NetSetMan process before the change and then start it again after the change so that it recognises the new configuration.  I wasn't sure if the nsmService needed to stop and start in a similar way, but I assume not.  I have therefore commented out these lines.  The nsmService, as I understand it, simply facilitates NetSetMan operating under local privilege.

Depending on how it goes I may make this part of the NetSetMan boot sequence and only invoke NetSetMan after the AC7260 has been uninstalled.

Offline

#8 2021-03-26 17:24

NetSetMan Support
Administrator
Registered: 2005-08-06
Posts: 1,878

Re: WlanGetNetworkBssList Error when trying to auto switch

Thanks for the update.
Your assumption regarding the service is correct.
We are planning to fix this issue, but it is currently unclear how much effort we will need to put into this, so it is currently unclear if this can be included in the next update.

Offline

#9 2021-03-26 18:19

touriga
Member
Registered: 2021-03-05
Posts: 7

Re: WlanGetNetworkBssList Error when trying to auto switch

NetSetMan Support wrote:

Thanks for the update.
Your assumption regarding the service is correct.
We are planning to fix this issue, but it is currently unclear how much effort we will need to put into this, so it is currently unclear if this can be included in the next update.

I suspect that, even if you fix the error issue, users should avoid having multiple WiFi adapters unnecessarily and freely allowed to connect to the same SSID or MAC Address.

I have also just reviewed the Help File (excellent BTW) and have created sub-profiles for each adapter.  I had wondered why I couldn't restrict the profile to a specific adapter and now realise that sub-profiles are the way to do this.  I also suspect that this is why I started getting the "WlanGet..." after months of perfect operation.  I had refined the profile rules and in the process I think I deleted the AC7260 sub-profile thinking I did not need it, not realising that it was effectively playing an important role preventing use of the AC7260 adapter.

Anyway I had fun creating the workaround "fix" to a problem I had caused in the first place. smile

Last edited by touriga (2021-03-26 18:20)

Offline

#10 2021-12-15 21:48

NetSetMan Support
Administrator
Registered: 2005-08-06
Posts: 1,878

Re: WlanGetNetworkBssList Error when trying to auto switch

We have now implemented a solution that will use the currently connected wireless network adapter when switching to a network with a stronger signal, even if there are other wireless network adapters available.
This will be available with the next version 5.1.0.

Offline