Removing Insecure Wireless Connections with PowerShell
Thursday, 6 June 2013
Troy Hunt recently posted a great discussion about the dangers of letting your devices automatically connect to insecure wireless networks – especially if those have a common name like 'Starbucks' or 'Apple Demo'.
All devices let you "forget" a network when you are in range, and Windows 7 (and before) even had an interface that let you delete networks when they were out of range.
This dialog was removed in Windows 8, although the 'netsh' command still lets you accomplish it from the command line.
To fill this gap, a bunch of tools have sprung up, and Scott Hanselman just threw his hat into the ring, too. He wrote a custom C# app ("WiFi.exe"), even mentioning "I could have used PowerShell or something…".
If you wanted to go the PowerShell route, what would that look like?
Quite simple, in fact.
After a few helper functions, it's just "Get-UnsecureWlanProfile | Remove-WlanProfile".