Get a list of Wifi networks with PowerShell

Posted On 2017-12-12 by OGrehan
Tags: Powershell Scripting Windows
Views: 159

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​

About the Author

OGrehan has posted a total of 1 articles.

Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links