netsh wlan command reference · Windows Wi-Fi from the CLI
Half of these I can never remember. So I dumped every netsh wlan command I actually reach for into one page you can search. Digging out a saved Wi-Fi password. Listing the networks you’ve joined, forgetting one, backing the whole lot up and shoving it back onto a fresh machine. Scanning the air for a clear channel. Flagging a connection as metered when the data cap gets close. Randomising your MAC. Reading what the driver can actually do, building that WLAN report when the connection keeps dropping. Even spinning up a little software hotspot, if your adapter still allows it. Each card gives you a one-click Copy and a plain explanation, plus the output you’ll get back and the variants I end up needing. Anything wrapped in <…> is yours to swap in.
Placeholders: <SSID> = network name · <password> = your key · C:\... = a folder you pick. Read-only stuff runs as a normal user. The ones tagged Admin want an elevated prompt (Run as administrator). Same behaviour in Command Prompt and in PowerShell.
How to use this netsh wlan reference
netsh wlan is really just the command-line front end to WLAN AutoConfig, the Windows service that runs your Wi-Fi under the hood. It behaves the same in Command Prompt and in PowerShell, because netsh is its own little program, not a shell built-in. Open whichever terminal you like, paste a command, drop your own value wherever you see <placeholder>. One trick ties the whole thing together, though: run netsh wlan show profiles first. It hands you the exact network names, and those names are what every show, delete, export and connect command is fishing for. The cards carry variants too. Little tweaks I keep needing, like aiming at one adapter or pulling a single line out of the output. Or just flipping a setting back.
The five commands that cover most Wi-Fi tasks
| Goal | Command |
|---|---|
| Reveal a saved Wi-Fi password | netsh wlan show profile name="SSID" key=clear |
| List every saved network | netsh wlan show profiles |
| Check the current connection & signal | netsh wlan show interfaces |
| Back up all profiles with passwords | netsh wlan export profile key=clear folder="C:\WiFiBackup" |
| Diagnose flaky Wi-Fi | netsh wlan show wlanreport |
Reveal a saved Wi-Fi password
This is why most people land here. You’re on a laptop that’s been joined to a network for months, the password’s long forgotten, and now you want it for your phone. Two commands. First netsh wlan show profiles to read off the exact name. Then netsh wlan show profile name="YourNetwork" key=clear, and the password is sitting on the Key Content line in plain text. Catch is, that second one only coughs up the key from an admin terminal. Run it as a normal user and the line’s just blank, no warning, nothing. People assume it’s broken. It isn’t, you just need the elevated prompt.
One more thing on the name. It has to match what show profiles printed, character for character, and if there’s a space in it you keep the quotes. name="My Home 5G", not name=My Home 5G. Get that wrong and netsh shrugs and tells you the profile doesn’t exist.
List, forget, and pick your saved networks
Everything starts with netsh wlan show profiles. It dumps every wireless profile Windows is holding onto, and those names are the keys to the whole kit: show, export, connect, delete, all of them want a name from that list. Done with a network for good? netsh wlan delete profile name="YourNetwork" wipes the profile so Windows quits auto-joining it. Be a little careful, the name field takes wildcards, so name="*" nukes every saved network in one shot and there’s no undo. I’ve done it. Once.
If you just want to stop a network connecting on its own without throwing the saved key away, that’s a different command, netsh wlan set profileparameter name="YourNetwork" connectionmode=manual. Good for a phone hotspot you only fire up now and then.
See the networks around you and find a clear channel
netsh wlan show networks lists what your adapter can see right now, names and security type. That’s the quick look. The version I actually use is netsh wlan show networks mode=bssid, because it adds the part that matters: every access point’s BSSID, its signal percentage, the radio type, and the channel each one is parked on. Read down that list and you can see exactly where the congestion is. On 2.4 GHz you want channel 1, 6 or 11 (those are the ones that don’t overlap), and on 5 GHz you grab whatever your neighbours aren’t sitting on. Then you go change the router. Honestly half my “the Wi-Fi is slow” problems have turned out to be four routers fighting over channel 6.
Back up your profiles and move them to a new PC
Rebuilding a machine? Don’t go hunting for password stickers. Make a folder, then netsh wlan export profile key=clear folder="C:\WiFiBackup" drops one XML file per network, keys and all, into it. Want a single network instead of the lot, add name="YourNetwork" before the folder bit. On the new box you pull each one back with netsh wlan add profile filename="C:\WiFiBackup\Wi-Fi-YourNetwork.xml". The exported files come out named Interface-Profile.xml, so point the import at that exact filename. Skip key=clear on the export and the keys get encrypted, which means they’ll only restore for the same user on the same PC, useless for a migration but fine if you’re just keeping a copy somewhere shared.
Check the connection, then connect or drop it
For a fast health check there’s nothing quicker than netsh wlan show interfaces. It tells you what you’re on, the SSID, the channel, the radio type, and the signal as a percentage. Rough read: above 75% you’re golden, under 30% expect it to stutter. To join a network you already have a profile for, netsh wlan connect name="YourNetwork" does it, and the profile name and the SSID usually line up so one name covers both. To drop the link without forgetting anything, just netsh wlan disconnect. Windows keeps the profile and can reconnect on its own later. Both of those run fine as a standard user, no elevation needed.
And before you try anything hotspot-related, run netsh wlan show drivers and look for Hosted network supported: Yes. That one line decides whether the software hotspot is even on the table for your adapter. If it reads No, save yourself the half hour, it isn’t happening on that driver.
Admin rights vs standard user
The harmless stuff runs fine in a plain terminal: listing profiles and interfaces, scanning for what’s around. The moment you want to do something that actually matters, though, you’ll need an elevated prompt (right-click, Run as administrator). That’s revealing keys, exporting with key=clear, anything to do with the hosted network, turning on tracing, poking at WLAN AutoConfig, setting MAC randomization, adding or pulling filters. Here’s the bit that trips people up. When you’re not elevated, a few of these don’t even error. They just print nothing at all. So if a command comes back empty, or barks about access denied, reopen the terminal as admin and run it again.
netsh wlan and modern Windows
One honest caveat. The hosted-network hotspot commands are showing their age. Microsoft would rather you used the graphical Mobile hotspot now, and a fair number of drivers have quietly stopped advertising hosted-network support at all. Before you build anything on top of it, check netsh wlan show drivers and look for Hosted network supported: Yes. If it says No, don’t fight it, you won’t win. The rest of what’s here is alive and well (profiles, passwords, exports, randomization, that diagnostic report), and honestly I think it’s still the fastest way to deal with Wi-Fi without clicking through five Settings panes. Maybe that’s just my muscle memory talking.
Frequently asked questions
How do I see my Wi-Fi password from the command line?
Two steps. Run netsh wlan show profiles to grab the network’s exact name. Then netsh wlan show profile name="YourSSID" key=clear and read the Key Content line. That’s your password, sitting there in plain text. Careful, though: the second command only spills the key from an admin terminal. From a normal one that line just stays blank.
Do netsh wlan commands need administrator rights?
Some do, some don’t. The read-only ones are happy as a standard user: show profiles, show interfaces, show networks, that sort of thing. But the moment you want to reveal keys, or export with key=clear, or mess with the hosted network, start tracing, change WLAN AutoConfig, set MAC randomization, touch filters, you’ll need that elevated prompt. When you’re not sure, honestly, just run it as administrator and move on.
How do I back up and restore my Wi-Fi profiles?
Make the folder first. Then run netsh wlan export profile key=clear folder="C:\WiFiBackup". That drops one XML file per network, password and all. Over on the new machine you pull each one back in with netsh wlan add profile filename="C:\WiFiBackup\Wi-Fi-SSID.xml". The files come out named Interface-Profile.xml so match that pattern when you point the import at them. I run this every time I rebuild a laptop. Saves a lot of squinting at password stickers stuck to the bottom of a router.
How do I set a Wi-Fi network as metered with netsh?
It’s the cost parameter. Run netsh wlan set profileparameter name="YourSSID" cost=Fixed and Windows starts treating that network as metered. cost=Unrestricted flips it back. Why bother? On a metered connection Windows holds off on the big background downloads and a chunk of Windows Update. Exactly what you want when you’re tethered to your phone and the data cap is creeping up.
How do I randomize my MAC address for privacy?
Depends how wide you want to go. For one network, netsh wlan set profileparameter name="YourSSID" randomization=yes does it. Swap in daily if you’d rather get a fresh address every day. Want the whole adapter covered at once? Use netsh wlan set randomization enabled=yes interface="Wi-Fi" instead. If your driver doesn’t support randomization the command just fails, so check show drivers when it won’t take.
Does netsh wlan work in PowerShell?
Yep. No surprises there. netsh is its own executable, so it runs the same whether you’re in PowerShell or in Command Prompt. Even a pipe like netsh wlan show interfaces | findstr SSID behaves identically in both. No need to hunt down some PowerShell module for any of it. The same commands just work.
How do I see the Wi-Fi networks around me?
Run netsh wlan show networks for a plain list of what’s in range. For the useful version, the one that shows signal strength and which channel each router is on, add the mode flag: netsh wlan show networks mode=bssid. Read down the channels and you’ll spot the crowded ones fast. On 2.4 GHz the non-overlapping channels are 1, 6 and 11, so if half your neighbours are crammed onto 6, move your router off it. No admin rights needed for either command.
How do I delete or forget a saved Wi-Fi network?
netsh wlan delete profile name="YourNetwork", and Windows stops auto-connecting to it. The name has to match what netsh wlan show profiles printed. Quick warning: the name field accepts wildcards, so name="*" deletes every saved profile at once, and there’s no taking it back. Handy when you’re wiping a machine for someone else, a small disaster when you fat-finger it.
How do I create a Wi-Fi hotspot with netsh?
First check that netsh wlan show drivers actually says Hosted network supported: Yes. If it doesn’t, stop right here, your driver won’t play along. If it does, run netsh wlan set hostednetwork mode=allow ssid="MyHotspot" key="password", then netsh wlan start hostednetwork. Last bit, and people forget this one: go into Network Connections and share your real connection onto the new adapter, otherwise clients join but get no internet. That said, on a modern Windows box I’d probably just flip on the Mobile hotspot in Settings. Less fiddly, I think.
Why does a netsh wlan command return nothing or an error?
In my experience it’s almost always one of a few things. The Wi-Fi adapter is switched off. The WLAN AutoConfig service (WlanSvc) isn’t running. You needed admin rights and didn’t have them. Or the driver simply doesn’t do that feature, and hosted network and randomization are the usual no-shows. So work down the list. Confirm the adapter’s on, make sure WlanSvc is started, reopen the terminal as administrator, then run netsh wlan show drivers to see what your hardware actually supports.
Sources & further reading
- Microsoft Learn, netsh wlan command reference
- Microsoft Learn, netsh (overview)
- Microsoft Learn, Windows commands index













