【发布时间】:2019-09-26 20:16:00
【问题描述】:
当密码以空格开头时,无法使用 xml 配置文件连接到 Wi-Fi
您好,我使用的是 Windows10,我的 Wi-Fi 卡是 Intel(R) Dual Band Wireless-AC 7265。
如果我通过选择网络名称并手动输入密码手动连接到 ESSID,则我的 ESSID(我将其称为“MY_NETWORK_SSID”)有一个以空格开头的密码(比如说“StartsWithWhiteSpace”)很好,但是如果我使用此配置文件与 netsh 命令进行连接,它会失败:
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>MY_NETWORK_SSID</name>
<SSIDConfig>
<SSID>
<hex>6D746C70617461625DA3546455727473</hex>
<name>MY_NETWORK_SSID</name>
</SSID>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>auto</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>false</protected>
<keyMaterial> StartsWithWhiteSpace</keyMaterial>
</sharedKey>
</security>
</MSM>
<MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">
<enableRandomization>false</enableRandomization>
<randomizationSeed>1191479147</randomizationSeed>
</MacRandomization>
</WLANProfile>
注意:
我还尝试了 (&#32; 和 \u0020) 来表示空白。
我还尝试了 protected=true 并对这个 xml 的密码 keyMaterial 字段进行编码:
" P@ssword!23" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString
但不幸的是,这也不起作用。
【问题讨论】:
标签: xml powershell netsh wifi