Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $profiles=(netsh wlan show profiles | Select-String "All User Profile\s+:\s+(.*)").Matches.Groups | Where-Object {$_.Value -notmatch "All User Profile*"} | Foreach {
- $wlan=netsh wlan show profiles name=$_ key=clear
- [pscustomobject][ordered]@{
- 'SSID' = ($wlan | Select-String "SSID Name\s+:\s+(.*)").Matches.Groups[1].Value
- 'Radio Type' = ($wlan | Select-String "Radio Type\s+:\s+(.*)").Matches.Groups[1].Value
- 'Authentication' = ($wlan | Select-String "Authentication\s+:\s+(.*)").Matches.Groups[1].Value
- 'Password' = ($wlan | Select-String "Key Content\s+:\s+(.*)").Matches.Groups[1].Value
- }
- } | Out-GridView -Title "Saved Wi-Fi passwords (Hold CTRL and select Wi-Fi profiles to apply actions on them)" -Passthru
- "You have selected:`n$($profiles)"
- $msg=@"
- `n
- [1] Delete
- [2] Quit
- "@
- choice /c 12 /n /m $Msg
- switch($LastExitCode){
- 1{$profiles|foreach{netsh wlan delete profile name=$_.ssid}}
- 2{exit 0}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement