-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-WifiProfiles.ps1
More file actions
35 lines (27 loc) · 1.14 KB
/
Get-WifiProfiles.ps1
File metadata and controls
35 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# PS Script to pull all wireless profile SSIDs and Passwords for documention
# Goes without saying, don't be an asshole with this.
# Written by Jonathan Bullock
# 2023 - 11 - 25
#
# Create BIT directory if it doesn't exist
$directoryPath = "C:\brockit\"
if (!(Test-Path -Path $directoryPath)) {
New-Item -Path $directoryPath -ItemType Directory
}
# Get all Wi-Fi profiles
$profiles = netsh wlan show profiles | Select-String -Pattern "All User Profile" | ForEach-Object { $_.ToString().Split(":")[1].Trim() }
# create array to hold profile details
$profileDetails = @()
foreach ($profile in $profiles) {
# Get the security key for each profile
$key = netsh wlan show profile name="$profile" key=clear | Select-String -Pattern "Key Content" | ForEach-Object { $_.ToString().Split(":")[1].Trim() }
# Create an object to hold the profile details
$profileDetail = New-Object PSObject -Property @{
SSID = $profile
Password = $key
}
# Add the details to the array
$profileDetails += $profileDetail
}
# Output the profile details
$profileDetails | Format-Table -AutoSize | Out-File -FilePath "C:\brockit\wifiprofiles.txt"