# encoding: ascii # api: powershell # title: Wireless Signal Strength # description: There are a couple scripts that parse netsh commands. I didn’t see this one already done, so I couldn’t steal it. I suppose I could use some regex or something simple to cut the whitespace, so feel free to “fix her up”, but this got the job done (of putting the netsh output into an object). This is a snip from a larger script I wrote as a looping, recording monitor. I used this guy’s script for inspiration: http://poshcode.org/1731 # version: 0.1 # author: Josh Popp # license: CC0 # x-poshcode-id: 5118 # x-archived: 2015-01-31T20:31:31 # x-published: 2015-04-25T20:10:00 # # # Wireless Statistics into object # Author: Josh Popp # Put Wireless Stats, like Signal Strengh, BSSID, and Channel into an object # First just dump the netsh output into $wlanraw $wlanraw = netsh wlan show interface # Create the object as "empty" $objWLAN = "" | Select-Object Name,SSID,BSSID,Channel,ReceiveRate,TransmitRate,Signal # Populate the object from the output, processing 1 line at a time ForEach ($Line in $wlanraw) { if ([regex]::IsMatch($Line," Name")) { $objWLAN.Name = $Line -Replace " Name : ","" } if ([regex]::IsMatch($Line," SSID")) { $objWLAN.SSID = $Line -Replace" SSID : ","" } if ([regex]::IsMatch($Line," BSSID")) { $objWLAN.BSSID = $Line -Replace" BSSID : ","" } if ([regex]::IsMatch($Line," Channel")) { $objWLAN.Channel = $Line -replace " Channel : ","" } if ([regex]::IsMatch($Line," Receive rate")) { $objWLAN.ReceiveRate = $Line -replace " Receive rate \(Mbps\) : ","" } if ([regex]::IsMatch($Line," Transmit rate")) { $objWLAN.TransmitRate = $Line -replace " Transmit rate \(Mbps\) : ","" } if ([regex]::IsMatch($Line," Signal")) { $objWLAN.Signal = $Line -replace " Signal : ","" } }