I really like this tool!
@Exit In English, I have a similar output "Unrestricted". For me, the offset is 7 instead of 6.
Return $aOutput[UBound($aOutput) - 7]
Here is my solution. How does this work on German version?
#include <Array.au3>
#include <string.au3>
Global $hDLL = DllOpen("user32.dll")
$aSSIDs = _GetSSIDs()
For $i = 0 To UBound($aSSIDs) - 1
$key = _GetKeyFromSSID($aSSIDs[$i])
ConsoleWrite(@TAB & $aSSIDs[$i] & @TAB & @TAB & $key & @CRLF)
Next
Func _GetSSIDs()
Local $iPID = Run(@ComSpec & " /c " & 'netsh wlan show profile', @ScriptDir, @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
ProcessWaitClose($iPID)
Local $sOutput = StdoutRead($iPID)
Local $aOutput = DllCall($hDLL, 'Int', 'OemToChar', 'str', $sOutput, 'str', '')
$aOutput = _StringExplode($aOutput[2], "-" & @CRLF)
$sOutput = $aOutput[UBound($aOutput) - 1]
Local $aSSIDs = _StringBetween($sOutput, " : ", @CRLF)
Return $aSSIDs
EndFunc ;==>_GetSSIDs
Func _GetKeyFromSSID($sSSID) ;returns "1" if key is not present
Local $iPID = Run(@ComSpec & " /c " & 'netsh wlan show profile name="' & $sSSID & '" key=clear', @ScriptDir, @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
ProcessWaitClose($iPID)
Local $sOutput = StdoutRead($iPID)
Local $aOutput = DllCall($hDLL, 'Int', 'OemToChar', 'str', $sOutput, 'str', '')
$aOutput = StringSplit($aOutput[2], @CRLF & "-", $STR_ENTIRESPLIT + $STR_NOCOUNT)
$aOutput = _StringBetween($aOutput[3], " : ", @CRLF)
Return $aOutput[UBound($aOutput) - 1]
EndFunc ;==>_GetKeyFromSSID
For reference, here is my English netsh output
BTW, there are still some nuances to work out, like this scenario.