XPost: misc.phone.mobile.iphone, comp.mobile.android, alt.internet.wireless   
   From: marianjones@helpfulpeople.com   
      
   Frank Slootweg wrote:   
   > Acknowledgement of *our* argument duly noted.   
      
   Hi Frank,   
      
   I noticed you ran the netsh command so I want to let you know I wasn't   
   aware, until recently, that the results depend on what's in the cache.   
      
   I wrote a query of the Windows newsgroup, asking if anyone knows of a way   
   to run that netsh command so that a full output occurs every single run.   
      
    From: Marian    
    Newsgroups: alt.comp.os.windows-10   
    Subject: How to show ALL nearby Wi-Fi AP's BSSID every time   
    Date: Sat, 13 Dec 2025 20:01:13 -0700   
    Message-ID: <10hl99p$1d1l$1@nnrp.usenet.blueworldhosting.com>   
      
   Essentially, we get a more full output if we run the netsh command moments   
   after we force our wifi adapter to reset than if it was already running.   
      
   For example, this only reports what's in the cache (AFAICT):   
    netsh wlan show networks mode=bssid   
   While this "can" force a refresh of that cache (AFAICT):   
    netsh wlan refresh && netsh wlan show networks mode=bssid   
      
   Although *toggling* the wifi adapter seems to garner the fullest results.   
      
   Since I always strive to add value to the tribal knowledge of the team,   
   below is my "netconnect" script to which I will add the scan after toggle.   
      
    @echo off   
    REM This is v1p2 of C:\data\sys\batch\netconnect.bat   
    REM Resets Wi-Fi to a consistent state after unexpected loss   
    REM v1p0 20251029   
    REM elevates to admin   
    REM toggles Wi-Fi to put it into a consistent state after reboot   
    REM then connects to a given named SSID   
    REM v1p1 20251101   
    REM added conditional checks and retries   
    REM v1p2 20251102   
    REM added loop to verify State/SSID and retry until truly connected   
      
    :: --- Elevate to admin if not already ---   
    >nul 2>&1 net session   
    if %errorlevel% neq 0 (   
    echo Requesting administrative privileges...   
    powershell -Command "Start-Process '%~f0' -Verb RunAs"   
    exit /b   
    )   
      
    :: Use "netsh interface show interface" to get adapter name   
    set adapter=Wi-Fi   
    :: Assumption is that the ssid:password has already been saved   
    set ssid=your.ssid_nomap   
      
    :: The saved SSID profile is used for credentials.   
    echo [%date% %time%] Toggling Wi-Fi adapter...   
    netsh interface show interface name=%adapter%   
      
    REM Disable the adapter (to set to a consistent state)   
    netsh interface set interface name=%adapter% admin=disable   
    timeout /t 5 >nul   
      
    REM Enable the adapter (to set to the desired state)   
    netsh interface set interface name=%adapter% admin=enable   
    timeout /t 10 >nul   
      
    echo Attempting to connect to %ssid%...   
      
    REM Connect to the specified SSID after adapter is fully enabled   
    powershell -Command "Enable-NetAdapter -Name '%adapter%' -Confirm:$false"   
    timeout /t 5 >nul   
      
    REM Added loop to verify State/SSID and retry until truly connected   
    set retries=3   
    :retry   
    echo Connecting to %ssid%...   
    netsh wlan connect name=%ssid%   
    timeout /t 5 >nul   
      
    for /f "tokens=2 delims=:" %%A in ('netsh wlan show interfaces ^| findstr   
   /C:"State"') do (   
    set state=%%A   
    )   
    for /f "tokens=2 delims=:" %%A in ('netsh wlan show interfaces ^| findstr   
   /C:"SSID" ^| findstr /V "BSSID"') do (   
    set currentSSID=%%A   
    )   
      
    set state=%state: =%   
    set currentSSID=%currentSSID: =%   
      
    if /I "%state%"=="connected" if /I "%currentSSID%"=="%ssid%" (   
    echo Connected successfully to %ssid%.   
    goto done   
    ) else (   
    set /a retries-=1   
    if %retries% gtr 0 (   
    echo Not connected yet. Retrying...   
    timeout /t 5 >nul   
    goto retry   
    ) else (   
    echo Connection failed after multiple attempts.   
    )   
    )   
      
    :done   
      
    echo [%date% %time%] Done. Check your connection status.   
    echo Final adapter status:   
    netsh interface show interface name=%adapter%   
    netsh wlan show interfaces   
    pause   
    :: end of C:\data\sys\batch\netconnect.bat   
   --   
   I invest energy in composing Usenet posts because I care greatly about people   
   getting full & complete information so we improve our knowledge.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|