PoshCode Archive  Artifact [ff5634a8cc]

Artifact ff5634a8ccdbd85129bbdfe83b96c5a3a2209d84c7de46d685d70d4d826f54ca:

  • File Get-WifiNetwork.ps1 — part of check-in [a9cadc5d5d] at 2018-06-10 14:18:18 on branch trunk — Get-WifiNetwork – return 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.) (user: Oisin Grehan size: 1125)

# encoding: ascii
# api: powershell
# title: Get-WifiNetwork
# description: Get-WifiNetwork – return 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.)
# version: 0.1
# type: function
# author: Oisin Grehan
# license: CC0
# function: Get-WifiNetwork
# x-poshcode-id: 6607
# x-archived: 2016-11-08T01:51:55
# x-published: 2016-11-04T03:57:00
#
#
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