Skip to content

Add support for WPA3-Personal #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions Public/OSDCloudTS/OSD.WinRE.WiFi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@ if ($env:SystemDrive -eq 'X:') {
$network = Get-WinREWiFi | Where-Object { $_.SSID -eq $SSID }

$password = ""
$notWPA2 = ""

if ($network.Authentication -ne "Open") {
$cred = Get-Credential -Message "Enter password for WIFI network '$SSID'" -UserName $SSID
$password = $cred.GetNetworkCredential().password
}

#TODO it can be WEP or enterprise ...but I don't know how Authentication value look like for them
$notWPA2 = $network | Where-Object { $_.Authentication -ne "WPA2-Personal" }
#TODO Add more modes like WEP or enterprise here:
if ($network.Authentication -eq "WPA-Personal") {
$authmode = "WPAPSK"
$encmode = "AES"
}
if (($network.Authentication -eq "WPA2-Personal") -or ($network.Authentication -eq "WPA3-Personal")) {
$authmode = "WPA2PSK"
$encmode = "AES"
}
if (($network.Authentication -eq "WPA3-Personal") -and (netsh wlan show driver | Select-String -Pattern "WPA3-Personal")) {
$authmode = "WPA3SAE"
$encmode = "AES"
}

# just for sure
Expand All @@ -26,7 +37,7 @@ if ($env:SystemDrive -eq 'X:') {
WLanName = $SSID
}
if ($password) { $param.Passwd = $password }
if ($notWPA2) { $param.WPA = $true }
if ($authmode) { $param.WPA = $true }
Set-WinREWiFi @param

# connect to network
Expand Down Expand Up @@ -137,16 +148,7 @@ if ($env:SystemDrive -eq 'X:') {
$Passwd = [System.Security.SecurityElement]::Escape($Passwd)
}

if ($WPA -eq $false) {
$WpaState = "WPA2PSK"
$EasState = "AES"
}
else {
$WpaState = "WPAPSK"
$EasState = "AES"
}

$XMLProfile = @"
$XMLProfile = @"
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>$WlanName</name>
Expand All @@ -160,8 +162,8 @@ if ($env:SystemDrive -eq 'X:') {
<MSM>
<security>
<authEncryption>
<authentication>$WpaState</authentication>
<encryption>$EasState</encryption>
<authentication>$authmode</authentication>
<encryption>$encmode</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
Expand Down