无法将 AD 模块加载到 powershell 脚本中

Cannot load AD module into powershell script

我正在为我的公司开发一个程序,该程序需要对用户的用户名进行检查,这要求仅在程序打开时安装 AD 模块。它在我的电脑上运行良好,但我是管理员,我 运行 Windows 10。我的环境的其余部分是 Windows 7.

我的代码:

Import-Module "\FileServer\common\IT\Powershell\Modules\ActiveDirectory"

错误:

Import-Module: Could not load file or assembly 'file://\bmh01-fs03\common\IT\Powershell\Modules\ActiveDirectory\Microsoft.ActiveDirectory.Management' or one of its dependencies. The ststem cannot find the file specified.

是AD模块里面的东西吗?为什么它可以在我的 PC 上运行,而不是用户?

ActiveDirectory 模块是一个不可再分发的模块。它是远程服务器管理工​​具 (RSAT) 的一部分,您必须将其安装在客户端上。

如果您想避免此类依赖关系,您可以使用 [ADSI] 提供程序查询 Active Directory。