Get a list of Wifi networks with PowerShell

By | 2017-12-12

Returns the parsed output of netsh wlan show network mode=bssid in psobject form. Does exactly what it says on the tin. Requires Vista/2008 or higher, or XP SP3 with a hotfix (I can’t recall which one, sorry.)

function Get-WifiNetwork {
 end {
  netsh wlan sh net mode=bssid | % -process {
    if ($_ -match '^SSID (\d+) : (.*)$') {
        $current = @{}
        $networks += $current
        $current.Index = $matches[1].trim()
        $current.SSID = $matches[2].trim()
    } else {
        if ($_ -match '^\s+(.*)\s+:\s+(.*)\s*$') {
            $current[$matches[1].trim()] = $matches[2].trim()
        }
    }
  } -begin { $networks = @() } -end { $networks|% { new-object psobject -property $_ } }
 }
}
ps> Get-WifiNetwork| select index, ssid, signal, 'radio type' | sort signal -desc | ft -auto​

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.