Чтобы получить пароль Wi-Fi с помощью PowerShell, вы можете использовать следующие методы:
Способ 1: использование команды netsh
$profileName = "YourNetworkName"
$password = (netsh wlan show profile name=$profileName key=clear) -match "Key Content\s+:\s+(.*)"
$wifiPassword = $matches[1]
Write-Host "Wi-Fi Password: $wifiPassword"
Метод 2: использование командлета Get-WmiObject
$profileName = "YourNetworkName"
$networkAdapter = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.NetConnectionID -ne $null -and $_.NetConnectionID -eq "Wi-Fi"}
$networkAdapterConfig = Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Where-Object {$_.ServiceName -eq $networkAdapter.PNPDeviceID}
$wifiPassword = $networkAdapterConfig.GetNetworkConnectionProfile().GetPassphrase()
Write-Host "Wi-Fi Password: $wifiPassword"
Метод 3. Использование командлета Get-WmiObject (альтернативный метод)
$profileName = "YourNetworkName"
$wifiProfile = Get-WmiObject -Namespace "root\wmi" -Class MSNdis_80211_WirelessNetworkAdapter | Where-Object {$_.ElementName -eq $profileName}
$wifiPassword = [System.Text.Encoding]::ASCII.GetString($wifiProfile.NetworkKey)
Write-Host "Wi-Fi Password: $wifiPassword"