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

Windows11下PowerShell 5导入ActiveDirectory模块报错求助

解决Import-Module ActiveDirectory时的凭证/目标名错误

针对你遇到的WARNING: Error initializing default drive: "Either the target name is incorrect, or the server has rejected the client credentials."警告,按以下步骤排查解决:

  • 使用域管理员权限运行PowerShell
    普通用户权限无法完成AD模块的初始化,右键PowerShell选择「以管理员身份运行」,重新执行Import-Module ActiveDirectory。

  • 手动指定AD服务器导入模块
    自动查找AD服务器可能出现解析错误,手动指定服务器地址:

    Import-Module ActiveDirectory -Server "你的AD服务器域名或IP地址"
    

    同时用nslookup验证域名解析是否正常:

    nslookup 你的AD域域名
    

    若解析失败,检查本地DNS设置,确保指向域内的DNS服务器。

  • 提供有效的域凭证
    如果当前登录账号不是域账号,手动输入域管理员凭证:

    $cred = Get-Credential -Message "输入域管理员账号和密码"
    Import-Module ActiveDirectory -Credential $cred -Server "你的AD服务器域名"
    

    同时确认该域账号未被禁用、密码未过期,且拥有访问AD服务器的权限。

  • 重新安装RSAT的AD组件
    已安装的RSAT组件可能损坏:

    1. 打开「设置」→「应用」→「可选功能」,找到「RSAT: Active Directory Domain Services and Lightweight Directory Tools」
    2. 点击卸载,重启系统后重新安装该组件,再尝试导入模块。
  • 检查PowerShell执行策略
    过严的执行策略会阻止模块加载,先查看当前策略:

    Get-ExecutionPolicy
    

    若为Restricted,修改为RemoteSigned:

    Set-ExecutionPolicy RemoteSigned -Force
    

内容的提问来源于stack exchange,提问作者Franco

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 19:22:03