Search Tools Links Login

PowerShell & NetSH to Get Wifi Passwords


This is for instructional purposes only.

This one-liner found kicking around a newsgroup somewhere shows how you can leverage PowerShell and NetSH to get a list of the WiFi network profiles on the local machine, along with the passwords for those networks. As always, watch for line wrap below. 

(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)}  | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table -AutoSize

About this post

Posted: 2022-09-14
By: dwirch
Viewed: 259 times

Categories

Tip

Scripting

Powershell

PowerShell Code Cache

Attachments

No attachments for this post

Special Instructions

This post is for instructional purposes only.  If you decide to use this, you are solely responsible.  The author and website owner will not be held responsible for anyone deciding to use this information.

See the legal pages for more information.


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.