Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.microsoft.windows > #3038 > unrolled thread

Re: How to show ALL nearby Wi-Fi AP's BSSID every time

Started byMarian <marianjones@helpfulpeople.com>
First post2025-12-14 01:14 -0700
Last post2025-12-15 19:04 -0700
Articles 10 — 4 participants

Back to article view | Back to alt.comp.microsoft.windows

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to show ALL nearby Wi-Fi AP's BSSID every time Marian <marianjones@helpfulpeople.com> - 2025-12-14 01:14 -0700
    Re: How to show ALL nearby Wi-Fi AP's BSSID every time Paul <nospam@needed.invalid> - 2025-12-14 05:58 -0500
      Re: How to show ALL nearby Wi-Fi AP's BSSID every time Marian <marianjones@helpfulpeople.com> - 2025-12-14 10:50 -0700
        Re: How to show ALL nearby Wi-Fi AP's BSSID every time rbowman <bowman@montana.com> - 2025-12-14 19:41 +0000
          Re: How to show ALL nearby Wi-Fi AP's BSSID every time knuttle <keith_nuttle@yahoo.com> - 2025-12-14 19:54 -0500
            Re: How to show ALL nearby Wi-Fi AP's BSSID every time Paul <nospam@needed.invalid> - 2025-12-14 22:50 -0500
              Re: How to show ALL nearby Wi-Fi AP's BSSID every time Marian <marianjones@helpfulpeople.com> - 2025-12-15 04:22 -0700
                Re: How to show ALL nearby Wi-Fi AP's BSSID every time rbowman <bowman@montana.com> - 2025-12-15 20:15 +0000
                  Re: How to show ALL nearby Wi-Fi AP's BSSID every time Marian <marianjones@helpfulpeople.com> - 2025-12-15 18:47 -0700
                    Re: How to show ALL nearby Wi-Fi AP's BSSID every time Marian <marianjones@helpfulpeople.com> - 2025-12-15 19:04 -0700

#3038 — Re: How to show ALL nearby Wi-Fi AP's BSSID every time

FromMarian <marianjones@helpfulpeople.com>
Date2025-12-14 01:14 -0700
SubjectRe: How to show ALL nearby Wi-Fi AP's BSSID every time
Message-ID<10hlrkg$1brb$1@nnrp.usenet.blueworldhosting.com>
Marian wrote:
> It found about a score of APs, but with different amounts in each scan.

I added a better output summary. I tried to get a RSSI histogram, 
but it was just too cumbersome; so I backed off & just added counts.

It's a bummer that Windows isn't reliable in outputting all the 
access points nearby in a single command, but this works reasonably.

 @echo off
 REM This is C:\data\sys\batch\netscan.bat version 2p1
 REM Logs the fullest list possible of all nearby Wi-Fi APs
 REM v1p0 20251213 outputs wifi adapter AP cache to a log file
 REM v1p1 20251213 disconnects/reconnects Wi-Fi, then outputs AP cache
 REM v1p2 20251213 captures multiple snapshots for the fullest AP list
 REM v1p3 20251213 captures multiple AP scans with timestamps for each
 REM v1p4 20251213 build a consolidated summary of the full list of AP's 
 REM v1p5 20251213 count the unique BSSIDs and SSIDs found in the AP scan
 REM v1p6 20251213 add a summary of BSSIDs and SSIDs found per scan
 REM v1p7 20251213 add a signal-strength histogram via PowerShell
 REM v1p8 20251213 separate scan results into files for better counts
 REM v1p9 20251213 tried to create histogram using PowerShell but failed
 REM v2p0 20251213 reverted to 1p6 and created tmp files to fix counts
 REM v2p1 20251213 added per-scan BSSID counts along with the SSID counts
 REM Note: Without admin, we can only toggle known Wi-Fi profiles
 REM Note: Use netconnect.bat for a more powerful adapter reset with admin
 
 setlocal enabledelayedexpansion
 set ssid=mcdonalds.foyer_nomap
 set "logdir=C:\data\sys\log"
 if not exist "%logdir%" mkdir "%logdir%"
 
 for /f %%A in ('wmic os get localdatetime ^| find "."') do set dt=%%A
 set "ts=%dt:~0,8%_%dt:~8,6%"
 set "logfile=%logdir%\wifiscan_%ts%.log"
 
 echo === Wi-Fi scan session started at %date% %time% === >> "%logfile%"
 
 REM 1) Disconnect from current SSID
 echo [%date% %time%] Disconnecting Wi-Fi...
 netsh wlan disconnect
 timeout /t 12 >nul
 
 echo === Scan A (disconnected state) at %date% %time% === >> "%logfile%"
 netsh wlan show networks mode=bssid > "%logdir%\scanA.tmp"
 type "%logdir%\scanA.tmp" >> "%logfile%"
 echo --- End of Scan A --- >> "%logfile%"
 
 REM 2) Reconnect to target SSID
 echo [%date% %time%] Reconnecting to %ssid%...
 netsh wlan connect name=%ssid%
 timeout /t 15 >nul
 
 echo === Scan B (after reconnect) at %date% %time% === >> "%logfile%"
 netsh wlan show networks mode=bssid > "%logdir%\scanB.tmp"
 type "%logdir%\scanB.tmp" >> "%logfile%"
 echo --- End of Scan B --- >> "%logfile%"
 
 REM 3) Wait longer for background scan to complete
 timeout /t 20 >nul
 echo === Scan C (delayed snapshot) at %date% %time% === >> "%logfile%"
 netsh wlan show networks mode=bssid > "%logdir%\scanC.tmp"
 type "%logdir%\scanC.tmp" >> "%logfile%"
 echo --- End of Scan C --- >> "%logfile%"
 
 REM 4) Build consolidated summary (union of SSIDs and BSSIDs with counts)
 echo === Consolidated AP Summary (union of all scans) === >> "%logfile%"
 
 REM Unique SSIDs
 echo --- Unique SSIDs --- >> "%logfile%"
 type "%logdir%\scanA.tmp" "%logdir%\scanB.tmp" "%logdir%\scanC.tmp" | findstr /R /C:"^SSID" | sort /unique > "%logdir%\ssid.tmp"
 type "%logdir%\ssid.tmp" >> "%logfile%"
 for /f %%C in ('type "%logdir%\ssid.tmp" ^| find /c /v ""') do set ssidcount=%%C
 echo Total unique SSIDs: %ssidcount% >> "%logfile%"
 
 REM Unique BSSIDs
 echo --- Unique BSSIDs --- >> "%logfile%"
 type "%logdir%\scanA.tmp" "%logdir%\scanB.tmp" "%logdir%\scanC.tmp" | findstr /R /C:"BSSID" | sort /unique > "%logdir%\bssid.tmp"
 type "%logdir%\bssid.tmp" >> "%logfile%"
 for /f %%C in ('type "%logdir%\bssid.tmp" ^| find /c /v ""') do set bssidcount=%%C
 echo Total unique BSSIDs: %bssidcount% >> "%logfile%"
 
 REM Per-scan SSID counts
 echo --- Per-scan SSID counts --- >> "%logfile%"
 for /f %%C in ('findstr /C:"SSID" "%logdir%\scanA.tmp" ^| find /c "SSID"') do set scanAcount=%%C
 for /f %%C in ('findstr /C:"SSID" "%logdir%\scanB.tmp" ^| find /c "SSID"') do set scanBcount=%%C
 for /f %%C in ('findstr /C:"SSID" "%logdir%\scanC.tmp" ^| find /c "SSID"') do set scanCcount=%%C
 echo Scan A SSIDs: %scanAcount% >> "%logfile%"
 echo Scan B SSIDs: %scanBcount% >> "%logfile%"
 echo Scan C SSIDs: %scanCcount% >> "%logfile%"
 
 REM Per-scan BSSID counts (new in v2p1)
 echo --- Per-scan BSSID counts --- >> "%logfile%"
 for /f %%C in ('findstr /C:"BSSID" "%logdir%\scanA.tmp" ^| find /c "BSSID"') do set scanAbssid=%%C
 for /f %%C in ('findstr /C:"BSSID" "%logdir%\scanB.tmp" ^| find /c "BSSID"') do set scanBbssid=%%C
 for /f %%C in ('findstr /C:"BSSID" "%logdir%\scanC.tmp" ^| find /c "BSSID"') do set scanCbssid=%%C
 echo Scan A BSSIDs: %scanAbssid% >> "%logfile%"
 echo Scan B BSSIDs: %scanBbssid% >> "%logfile%"
 echo Scan C BSSIDs: %scanCbssid% >> "%logfile%"
 
 del "%logdir%\scanA.tmp" "%logdir%\scanB.tmp" "%logdir%\scanC.tmp" "%logdir%\ssid.tmp" "%logdir%\bssid.tmp"
 
 echo === Wi-Fi scan session finished at %date% %time% === >> "%logfile%"
 echo Log written to %logfile%
 pause
 
 REM end of C:\data\sys\batch\netscan.bat 
-- 
Helping others & learning from them is what this Usenet ng is all about.

[toc] | [next] | [standalone]


#3041

FromPaul <nospam@needed.invalid>
Date2025-12-14 05:58 -0500
Message-ID<10hm58p$uv33$1@dont-email.me>
In reply to#3038
On Sun, 12/14/2025 3:14 AM, Marian wrote:
> Marian wrote:
>> It found about a score of APs, but with different amounts in each scan.
> 
> I added a better output summary. I tried to get a RSSI histogram, but it was just too cumbersome; so I backed off & just added counts.
> 
> It's a bummer that Windows isn't reliable in outputting all the access points nearby in a single command, but this works reasonably.
> 

It this is the case, you could craft a similar
test from Linux, and see if there is a disparity in behavior
or performance.

And for the purposes of blasting Windows like that, you
should also use a desktop with a Wifi on it as your
test client. Make sure it is not set to "turn off to save power"
in the Device Manager properties.

Give it every best chance to perform.

The behavior is just a bit unbounded, so it can't
really be perfect. There are passive and active techniques,
and the active case, a packet can be lost on a collision.

   Paul

[toc] | [prev] | [next] | [standalone]


#3042

FromMarian <marianjones@helpfulpeople.com>
Date2025-12-14 10:50 -0700
Message-ID<10hmtcg$t9e$1@nnrp.usenet.blueworldhosting.com>
In reply to#3041
Paul wrote:
>> Marian wrote:
>>> It found about a score of APs, but with different amounts in each scan.
>> 
>> I added a better output summary. I tried to get a RSSI histogram, but it was just too cumbersome; so I backed off & just added counts.
>> 
>> It's a bummer that Windows isn't reliable in outputting all the access points nearby in a single command, but this works reasonably.
>> 
> 
> It this is the case, you could craft a similar
> test from Linux, and see if there is a disparity in behavior
> or performance.

Hi Paul,

Thank you for understanding the problem set.

My goal was to find a native Windows scan that reliably found APs.
Windows only reports subsets of that scan unless you force it.
Even then, you can never know if it's the complete scan, or not.

Sigh.
It's a shame Windows isn't reliably reporting cached scans.

However, I agree with you that another operating system's Wi-Fi adapter
drivers might report the full scan instead of just what's lately been
cached. 

Also I'm sure there are freeware programs that will report APs reliably.

But my goal here is/was to find a *native* way to get Windows to reliably
report all access points it can see at any given moment in time.

> And for the purposes of blasting Windows like that, you
> should also use a desktop with a Wifi on it as your
> test client. Make sure it is not set to "turn off to save power"
> in the Device Manager properties.
> Give it every best chance to perform.

Yes. Understood. I'm on an old 2009 desktop with a USB stick acting as the
Wi-Fi card, for example. It's doing all it can, most likely, to scan as
little as possible. Thank you again for understanding the problem set.

> The behavior is just a bit unbounded, so it can't
> really be perfect. There are passive and active techniques,
> and the active case, a packet can be lost on a collision.

Well, I'm pretty sure there are programs out there that will give us a
reliable scan of the access point environment, and of course, my Ubiquiti
radios will do it for the frequencies they're set on (2.4GHz or 5GHz).

So certainly it "can" be done.

I was just hoping to do it with native Windows tools so that EVERYONE
could do it, but I agree with you that Windows is economizing on power.

[toc] | [prev] | [next] | [standalone]


#3044

Fromrbowman <bowman@montana.com>
Date2025-12-14 19:41 +0000
Message-ID<mq8i6qFlcl8U2@mid.individual.net>
In reply to#3042
On Sun, 14 Dec 2025 10:50:07 -0700, Marian wrote:

> However, I agree with you that another operating system's Wi-Fi adapter
> drivers might report the full scan instead of just what's lately been
> cached.

I'm seeing some variability. 

nmcli device wifi rescan
nmcli device wifi list

on three different machines give different lists. The most complete is the 
Lenovo laptop. Different chip sets and locations. 

The equivalent 'netsh wlan show networks' on the Windows laptop shows 7. 
The ones with the signal strength below 40 come and go. netsh doesn't show 
signal strength or the BSSID. I don't know if there are additional flags 
for that or to do a rescan.

[toc] | [prev] | [next] | [standalone]


#3049

Fromknuttle <keith_nuttle@yahoo.com>
Date2025-12-14 19:54 -0500
Message-ID<10hnm88$1hukm$1@dont-email.me>
In reply to#3044
On 12/14/2025 2:41 PM, rbowman wrote:
> On Sun, 14 Dec 2025 10:50:07 -0700, Marian wrote:
> 
>> However, I agree with you that another operating system's Wi-Fi adapter
>> drivers might report the full scan instead of just what's lately been
>> cached.
> 
> I'm seeing some variability.
> 
> nmcli device wifi rescan
> nmcli device wifi list
> 
> on three different machines give different lists. The most complete is the
> Lenovo laptop. Different chip sets and locations.
> 
> The equivalent 'netsh wlan show networks' on the Windows laptop shows 7.
> The ones with the signal strength below 40 come and go. netsh doesn't show
> signal strength or the BSSID. I don't know if there are additional flags
> for that or to do a rescan.e
> 
Have you consider interference?  A car is in the way one minute not the 
next.  IS there any relationship between the presence or disappearance 
of a station and signal strength?   i.e. the ones appearing and 
disappearing are weak station.

I have seen similar things on my own computer but assigned it to the 
variance of the signal transmission through the local environment and 
the change micro weather.   Some one turns on a motor, a TV, Microwave, etc

[toc] | [prev] | [next] | [standalone]


#3050

FromPaul <nospam@needed.invalid>
Date2025-12-14 22:50 -0500
Message-ID<10ho0he$1kkie$1@dont-email.me>
In reply to#3049
On Sun, 12/14/2025 7:54 PM, knuttle wrote:
> On 12/14/2025 2:41 PM, rbowman wrote:
>> On Sun, 14 Dec 2025 10:50:07 -0700, Marian wrote:
>>
>>> However, I agree with you that another operating system's Wi-Fi adapter
>>> drivers might report the full scan instead of just what's lately been
>>> cached.
>>
>> I'm seeing some variability.
>>
>> nmcli device wifi rescan
>> nmcli device wifi list
>>
>> on three different machines give different lists. The most complete is the
>> Lenovo laptop. Different chip sets and locations.
>>
>> The equivalent 'netsh wlan show networks' on the Windows laptop shows 7.
>> The ones with the signal strength below 40 come and go. netsh doesn't show
>> signal strength or the BSSID. I don't know if there are additional flags
>> for that or to do a rescan.e
>>
> Have you consider interference?  A car is in the way one minute not the next.  
> IS there any relationship between the presence or disappearance of a station and
> signal strength?   i.e. the ones appearing and disappearing are weak station.
> 
> I have seen similar things on my own computer but assigned it to the 
> variance of the signal transmission through the local environment and the 
> change micro weather.   Some one turns on a motor, a TV, Microwave, etc

There is a simulation of what it looks like, when a Wifi antenna is moved
about within a household.

   https://www.engadget.com/2014-09-01-wifi-physics-signal-reception.html

This is not a "perfect" simulation, but the intention of the grad student
sharing that with us, is to point out how there are gaps.

Radios work best when line-of-sight. And I've seen that with Bluetooth
transceivers. I had one of those short plugin ones, and it worked a lot
better when I put it on the end of an extension cord. And it also
had line-of-sight with the other transceiver that was also using
an extension cord.

But Bluetooth is so slow, it's really hard to tell when a path is
exceptionally good. It only delivers 75KB/sec or so. The Bluetooth signal
should propagate in the room, just like the grad student simulation.

   Paul

[toc] | [prev] | [next] | [standalone]


#3058

FromMarian <marianjones@helpfulpeople.com>
Date2025-12-15 04:22 -0700
Message-ID<10hor1i$2ktc$1@nnrp.usenet.blueworldhosting.com>
In reply to#3050
Paul wrote:
>> Have you consider interference?� A car is in the way one minute not the next.� 
>> IS there any relationship between the presence or disappearance of a station and
>> signal strength?�� i.e. the ones appearing and disappearing are weak station.
>> 
>> I have seen similar things on my own computer but assigned it to the 
>> variance of the signal transmission through the local environment and the 
>> change micro weather.�� Some one turns on a motor, a TV, Microwave, etc
> 
> There is a simulation of what it looks like, when a Wifi antenna is moved
> about within a household.

Let's make a point that is extremely crucial to make about Windows "netsh".

Assuming NOTHING changed (e.g., no interference, no movement whatsoever), 
Windows *still* will report *different* outputs depending on the cache.

So, while "interference" and "movement" will certainly change what APs any
given Windows computer will see, that's NOT the problem of this thread.

I just wanted to WARN people that the "netsh" command we've been using:
 C:\> netsh wlan refresh && netsh wlan show networks mode=bssid
Will give *less full* or "more full* results, depending on cache status.

In summary, the problem to resolve is NOT "interference" or "movement", 
but the fact that the netsh output depends on what's stored in cache
which itself has a temporal relationship to the last association time.

This thread is seeking a solution to *that* Windows "netsh" problem.

[toc] | [prev] | [next] | [standalone]


#3067

Fromrbowman <bowman@montana.com>
Date2025-12-15 20:15 +0000
Message-ID<mqb8j7F50jhU2@mid.individual.net>
In reply to#3058
On Mon, 15 Dec 2025 04:22:26 -0700, Marian wrote:

> In summary, the problem to resolve is NOT "interference" or "movement",
> but the fact that the netsh output depends on what's stored in cache
> which itself has a temporal relationship to the last association time.
> 
> This thread is seeking a solution to *that* Windows "netsh" problem.

nmcli on Linux does have a 'rescan' command. Running rescan and list on 
the same machine, same location, again and again, will frequently report 
different APs with different signal strengths. 

Another laptop, 10' away, shows a few more although that vaires between 
rescans. A laptop 4' away shows many more than the desktop.

I presume that the difference between machines is a combination of 
location and the wifi device, but that doesn't explain the difference 
between successive rescans on the same machine.

If netsh is broken, so is nmcli.

[toc] | [prev] | [next] | [standalone]


#3069

FromMarian <marianjones@helpfulpeople.com>
Date2025-12-15 18:47 -0700
Message-ID<10hqdnv$2jrj$1@nnrp.usenet.blueworldhosting.com>
In reply to#3067
rbowman wrote:
>> This thread is seeking a solution to *that* Windows "netsh" problem.
> 
> nmcli on Linux does have a 'rescan' command. Running rescan and list on 
> the same machine, same location, again and again, will frequently report 
> different APs with different signal strengths. 
> 
> Another laptop, 10' away, shows a few more although that vaires between 
> rescans. A laptop 4' away shows many more than the desktop.
> 
> I presume that the difference between machines is a combination of 
> location and the wifi device, but that doesn't explain the difference 
> between successive rescans on the same machine.
> 
> If netsh is broken, so is nmcli.


Thanks for your valuable testing input, and that of others on the team.
It's an unusual problem as we're used to definitive results from commands.

Apparently querying wi-fi adapters doesn't always give definitive results.

Usually, after a few days on Usenet, a thread comes to a resolution because
a solution is generally found, but in this case I suspect there is none.

It's "good enough" that we're all aware, at least, of the inconsistencies.

I guess the tribal knowledge we all learned is that, on Windows, 'netsh
wlan show networks' doesn't always trigger a fresh scan so it more often
reports cached results tied to the last association.

That's why we are seeing various temporal inconsistencies, where it's hard
to tell without many tests whether we have the "fullest" list or not.

Linux tools like 'nmcli rescan' or 'iwlist scan' do force active scans,
but even then, those results might vary because Wi-Fi scanning is
inherently probabilistic as it's due to beacon timing, channel hopping, and
chipset filtering, such that it may very well be that we'll never be able
to be absolutely sure we obtained the "fullest" list in any set of scans.

If we want more reliable data on Windows, we might look into the
Native Wifi API or PowerShell cmdlets, which maybe can trigger scans more
directly than 'netsh' (or nmcli/iwlist) can. Dunno yet.

Looking it up, cmdlets like Get-NetAdapter and Get-NetAdapterStatistics
provide info about the NIC, but they don�t trigger a scan themselves
 <https://www.cellstream.com/2025/12/05/windows-powershell-commands-for-wi-fi-and-wlans/>

Looking it up, this "supposedly" triggers a scan on all Wi-Fi interfaces:
 $wifi = New-Object -ComObject Wlanapi.WlanClient
 $wifi.Interfaces | ForEach-Object { $_.Scan() }

Which, if we wait a few moments, gives netsh a "better chance" at a
more-full access point listing to be in the adapter's cache memory.
 netsh wlan show networks mode=bssid

Separately I wrote up a script that disassociates the wi-fi adapter, and
then reassociates and runs a scan soon thereafter, which seems to work well 
(but you never know if you have the full list so that's why I had asked).

[toc] | [prev] | [next] | [standalone]


#3070

FromMarian <marianjones@helpfulpeople.com>
Date2025-12-15 19:04 -0700
Message-ID<10hqenh$pkl$1@nnrp.usenet.blueworldhosting.com>
In reply to#3069
Marian wrote:
> Looking it up, this "supposedly" triggers a scan on all Wi-Fi interfaces:
>  $wifi = New-Object -ComObject Wlanapi.WlanClient
>  $wifi.Interfaces | ForEach-Object { $_.Scan() }

That didn't work because the command isn't exposed on my Windows 10 system.

This "concept" is probably the best we can do without going to 3rd-party 
tools, where just retriggering doesn't work because it's the same cache.
 @echo off
 :: C:\data\sys\batch\triggerwifi.bat
 :: v1p0 20251215
 ::  repeatedly trigger scans and then dump the results.

 setlocal
 set SCANS=5

 for /L %%i in (1,1,%SCANS%) do (
    echo ==== Scan %%i ====
    netsh wlan show networks mode=bssid
    timeout /t 3 >nul
 )

 endlocal
 pause

The "best" so far that I've found that seems to get a "fuller" output is 
this script which disassociates & reassociates & then scans thereafter.

It expressly runs a disconnect and scan, a reconnect and scan, and a 
delayed snapshot and scan because Windows often caches results differently
depending on association state.

But sometimes it leaves the WI-FI adapter in the off state, so I need to
add some kind of protection code to make sure the adapter is online.

If we're willing to run with elevated privileges, we could force a full
adapter reset before scanning, but even then we could miss some APs.
  netsh interface set interface name="Wi-Fi" admin=disabled
  timeout /t 5 >nul
  netsh interface set interface name="Wi-Fi" admin=enabled

 @echo off
 REM This is C:\data\sys\batch\netscan.bat version 2p1
 REM Logs the fullest list possible of all nearby Wi-Fi APs
 REM Designed to NOT require admin 
 REM Note: Without admin, we can only toggle known Wi-Fi profiles
 REM Note: Use netconnect.bat for a more powerful adapter reset with admin
 
 setlocal enabledelayedexpansion
 set ssid=exxon.store_nomap
 set "logdir=C:\data\sys\log"
 if not exist "%logdir%" mkdir "%logdir%"
 
 for /f %%A in ('wmic os get localdatetime ^| find "."') do set dt=%%A
 set "ts=%dt:~0,8%_%dt:~8,6%"
 set "logfile=%logdir%\wifiscan_%ts%.log"
 
 echo === Wi-Fi scan session started at %date% %time% === >> "%logfile%"
 
 REM 1) Disconnect from current SSID
 echo [%date% %time%] Disconnecting Wi-Fi...
 netsh wlan disconnect
 timeout /t 12 >nul
 
 echo === Scan A (disconnected state) at %date% %time% === >> "%logfile%"
 netsh wlan show networks mode=bssid > "%logdir%\scanA.tmp"
 type "%logdir%\scanA.tmp" >> "%logfile%"
 echo --- End of Scan A --- >> "%logfile%"
 
 REM 2) Reconnect to target SSID
 echo [%date% %time%] Reconnecting to %ssid%...
 netsh wlan connect name=%ssid%
 timeout /t 15 >nul
 
 echo === Scan B (after reconnect) at %date% %time% === >> "%logfile%"
 netsh wlan show networks mode=bssid > "%logdir%\scanB.tmp"
 type "%logdir%\scanB.tmp" >> "%logfile%"
 echo --- End of Scan B --- >> "%logfile%"
 
 REM 3) Wait longer for background scan to complete
 timeout /t 20 >nul
 echo === Scan C (delayed snapshot) at %date% %time% === >> "%logfile%"
 netsh wlan show networks mode=bssid > "%logdir%\scanC.tmp"
 type "%logdir%\scanC.tmp" >> "%logfile%"
 echo --- End of Scan C --- >> "%logfile%"
 
 REM 4) Build consolidated summary (union of SSIDs and BSSIDs with counts)
 echo === Consolidated AP Summary (union of all scans) === >> "%logfile%"
 
 REM Unique SSIDs
 echo --- Unique SSIDs --- >> "%logfile%"
 type "%logdir%\scanA.tmp" "%logdir%\scanB.tmp" "%logdir%\scanC.tmp" | findstr /R /C:"^SSID" | sort /unique > "%logdir%\ssid.tmp"
 type "%logdir%\ssid.tmp" >> "%logfile%"
 for /f %%C in ('type "%logdir%\ssid.tmp" ^| find /c /v ""') do set ssidcount=%%C
 echo Total unique SSIDs: %ssidcount% >> "%logfile%"
 
 REM Unique BSSIDs
 echo --- Unique BSSIDs --- >> "%logfile%"
 type "%logdir%\scanA.tmp" "%logdir%\scanB.tmp" "%logdir%\scanC.tmp" | findstr /R /C:"BSSID" | sort /unique > "%logdir%\bssid.tmp"
 type "%logdir%\bssid.tmp" >> "%logfile%"
 for /f %%C in ('type "%logdir%\bssid.tmp" ^| find /c /v ""') do set bssidcount=%%C
 echo Total unique BSSIDs: %bssidcount% >> "%logfile%"
 
 REM Per-scan SSID counts
 echo --- Per-scan SSID counts --- >> "%logfile%"
 for /f %%C in ('findstr /C:"SSID" "%logdir%\scanA.tmp" ^| find /c "SSID"') do set scanAcount=%%C
 for /f %%C in ('findstr /C:"SSID" "%logdir%\scanB.tmp" ^| find /c "SSID"') do set scanBcount=%%C
 for /f %%C in ('findstr /C:"SSID" "%logdir%\scanC.tmp" ^| find /c "SSID"') do set scanCcount=%%C
 echo Scan A SSIDs: %scanAcount% >> "%logfile%"
 echo Scan B SSIDs: %scanBcount% >> "%logfile%"
 echo Scan C SSIDs: %scanCcount% >> "%logfile%"
 
 REM Per-scan BSSID counts (new in v2p1)
 echo --- Per-scan BSSID counts --- >> "%logfile%"
 for /f %%C in ('findstr /C:"BSSID" "%logdir%\scanA.tmp" ^| find /c "BSSID"') do set scanAbssid=%%C
 for /f %%C in ('findstr /C:"BSSID" "%logdir%\scanB.tmp" ^| find /c "BSSID"') do set scanBbssid=%%C
 for /f %%C in ('findstr /C:"BSSID" "%logdir%\scanC.tmp" ^| find /c "BSSID"') do set scanCbssid=%%C
 echo Scan A BSSIDs: %scanAbssid% >> "%logfile%"
 echo Scan B BSSIDs: %scanBbssid% >> "%logfile%"
 echo Scan C BSSIDs: %scanCbssid% >> "%logfile%"
 
 del "%logdir%\scanA.tmp" "%logdir%\scanB.tmp" "%logdir%\scanC.tmp" "%logdir%\ssid.tmp" "%logdir%\bssid.tmp"
 
 echo === Wi-Fi scan session finished at %date% %time% === >> "%logfile%"
 echo Log written to %logfile%
 pause
-- 
 
 REM end of C:\data\sys\batch\netscan.bat 

[toc] | [prev] | [standalone]


Back to top | Article view | alt.comp.microsoft.windows


csiph-web