ProductivityTools.PSGetCurrentWifiPassword.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function Get-CurrentWifiPassword {

    [cmdletbinding()]
    param()

    $wifiNetwork=Get-NetConnectionProfile -InterfaceAlias wi-fi
    $wifiName=$wifiNetwork.Name
    Write-Verbose "Current wifi name: $wifiName"
    
    $currentWifi=Get-WifiPassword -NetworkName $wifiName
    $password=$currentWifi.Password
    
    
    return $password

}

Export-ModuleMember Get-CurrentWifiPassword