You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows 10/11下PowerShell配置WiFi XML报错0x80001解决

解决WPA2-Enterprise(EAP-TTLS/PAP)WiFi配置XML格式错误及配置文件损坏问题

一、正确的RCJA.xml配置内容

以下是符合要求的WiFi配置XML,包含WPA2-Enterprise AES加密、EAP-TTLS认证、PAP密码方式,同时开启自动连接并提示用户输入账号密码:

<?xml version="1.0" encoding="UTF-8"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
    <name>RCJA</name>
    <SSIDConfig>
        <SSID>
            <name>RCJA</name>
        </SSID>
        <nonBroadcast>false</nonBroadcast>
    </SSIDConfig>
    <connectionType>ESS</connectionType>
    <connectionMode>auto</connectionMode>
    <MSM>
        <security>
            <authEncryption>
                <authentication>WPA2Enterprise</authentication>
                <encryption>AES</encryption>
                <useOneX>true</useOneX>
            </authEncryption>
            <OneX xmlns="http://www.microsoft.com/networking/OneX/v1">
                <EAPConfig>
                    <EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig">
                        <EapMethod>
                            <Type xmlns="http://www.microsoft.com/provisioning/EapCommon">21</Type>
                            <VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId>
                            <VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType>
                            <AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</AuthorId>
                        </EapMethod>
                        <Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig">
                            <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">
                                <Type>21</Type>
                                <EapType xmlns="http://www.microsoft.com/provisioning/EapTtlsConnectionPropertiesV1">
                                    <CredentialsSource>
                                        <Type>1</Type>
                                    </CredentialsSource>
                                    <ServerValidation>
                                        <DisableUserPromptForServerValidation>false</DisableUserPromptForServerValidation>
                                        <ServerNames></ServerNames>
                                    </ServerValidation>
                                    <DifferentUsername>false</DifferentUsername>
                                    <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1">
                                        <Type>1</Type>
                                        <EapType xmlns="http://www.microsoft.com/provisioning/EapPapConnectionPropertiesV1">
                                            <Password>
                                                <Type>1</Type>
                                            </Password>
                                        </EapType>
                                    </Eap>
                                </EapType>
                            </Eap>
                        </Config>
                    </EapHostConfig>
                </EAPConfig>
                <authMode>user</authMode>
                <singleSignOn>
                    <type>preLogon</type>
                    <maxDelay>0</maxDelay>
                </singleSignOn>
            </OneX>
        </security>
    </MSM>
    <MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">
        <enableRandomization>false</enableRandomization>
    </MacRandomization>
</WLANProfile>

关键配置说明

  • <connectionMode>auto</connectionMode>:开启自动连接
  • <CredentialsSource><Type>1</Type></CredentialsSource>:指定由用户手动输入账号密码(Type=1代表用户输入)
  • <EapType xmlns="http://www.microsoft.com/provisioning/EapTtlsConnectionPropertiesV1">:配置EAP-TTLS认证
  • 嵌套的<EapType xmlns="http://www.microsoft.com/provisioning/EapPapConnectionPropertiesV1">:指定PAP密码方式

二、对应的PowerShell执行脚本

以管理员身份运行PowerShell,执行以下命令导入配置文件:

# 假设RCJA.xml放在当前用户桌面,可根据实际路径修改
$xmlPath = "$env:USERPROFILE\Desktop\RCJA.xml"
netsh wlan add profile filename="$xmlPath" user=all

执行后会提示用户输入WiFi账号密码,完成配置。

三、常见错误排查(针对0x80001及配置文件损坏问题)

  • XML语法错误:检查所有标签是否闭合,比如<name>必须对应</name>,XML属性引号是否成对。Windows的WiFi配置XML对语法要求严格,任何标签遗漏或格式错误都会触发0x80001。
  • 编码问题:确保XML文件保存为UTF-8无BOM编码,用记事本或VS Code保存时选择该编码,BOM会导致netsh解析失败。
  • 权限问题:必须以管理员身份运行PowerShell,否则可能因权限不足导致配置文件写入失败,提示损坏。
  • 命名空间错误:XML中的xmlns属性必须正确,比如<WLANProfile>的命名空间是http://www.microsoft.com/networking/WLAN/profile/v1,<OneX>和<EapHostConfig>的命名空间也不能写错。
  • 参数错误:netsh命令中的filename路径必须正确,若路径含空格需用双引号包裹,user=all表示对所有用户生效。

内容的提问来源于stack exchange,提问作者juan carlos salazar caballero

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 05:55:06