Extract common functionality to WpaSupplicantConf.psm1

This commit is contained in:
cimryan
2018-10-24 22:33:51 -07:00
parent 27ed80059b
commit c607860052
4 changed files with 98 additions and 36 deletions

View File

@@ -11,21 +11,8 @@ Param
[string]$wifiPSK
)
$drivePath="${driveLetter}:"
Import-Module -Name ".\WpaSupplicantConf.psm1" -Force
$wpaSupplicantConfPath="$drivePath\wpa_supplicant.conf"
$wpaSupplicantConfContent=@"
network={
ssid="$wifiSSID"
psk="$wifiPSK"
}
"@
$utf8 = New-Object System.Text.UTF8Encoding $false
Add-Content -Value $utf8.GetBytes($wpaSupplicantConfContent) -Encoding Byte -Path "$wpaSupplicantConfPath"
Add-Network "$driveLetter" "$wifiSSID" "$wifiPSK"
Write-Verbose "All done."