lac.fi

Notes to self
› PowerShell: Wireless connection signal strength

Simple parser for a netsh command to collect SSID, BSSID and signal strength to an object.

$strDump = netsh wlan show interfaces
$objInterface = "" | Select-Object SSID,BSSID,Signal

foreach ($strLine in $strDump) {
	if ($strLine -match "^\s+SSID") {
		$objInterface.SSID = $strLine -Replace "^\s+SSID\s+:\s+",""
	} elseif ($strLine -match "^\s+BSSID") {
		$objInterface.BSSID = $strLine -Replace "^\s+BSSID\s+:\s+",""
	} elseif ($strLine -match "^\s+Signal") {
		$objInterface.Signal = $strLine -Replace "^\s+Signal\s+:\s+",""
	}
}

# Do whatever with the resulting object. We'll just print it out here
$objInterface