Created
August 7, 2020 08:54
-
-
Save moddingg33k/c2e0a7cf1363bf61fcaec9ab86a7cc3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-WiFiNetworks { | |
$RegEx = | |
@' | |
(?x) | |
SSID\s\d+\s:\s(?<SSID>[a-z0-9\-\*\.&_]+)\r\n | |
Network\stype\s+:\s(?<NetworkType>\w+)\r\n | |
Authentication\s+:\s(?<Authentication>[a-z0-9\-_]+)\r\n | |
Encryption\s+:\s(?<Encryption>\w+)\r\n | |
BSSID\s1\s+:\s(?<BSSID>(?:\w+:){5}\w+)\r\n | |
Signal\s+:\s(?<Signal>\d{1,2})%\r\n | |
Radio\stype\s+:\s(?<Radio>[a-z0-9\.]+)\r\n | |
Channel\s+:\s(?<Channel>\w+)\r\n | |
'@ | |
$WiFi = (netsh wlan show network mode=bssid | Select-Object -Skip 3).Trim() | Out-String | |
$Networks = $WiFi -split "\r\s+\n" | |
$Networks | ForEach-Object -Process { | |
If ($_ -match $RegEx) { | |
[pscustomobject]@{ | |
SSID = $Matches.SSID | |
NetworkType = $Matches.NetworkType | |
AuthenticationType = $Matches.Authentication | |
Encryption = $Matches.Encryption | |
BSSID1 = $Matches.BSSID | |
SignalPercentage = [int]$Matches.Signal | |
RadioType = $Matches.Radio | |
Channel = $Matches.Channel | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment