简体   繁体   English

无法使用 powershell 导入 Active Directory 模块

[英]Unable to import Active Directory module using powershell

I am trying to create a security group but before that i need to import Active Directory module in powershell.我正在尝试创建一个安全组,但在此之前我需要在 powershell 中导入 Active Directory 模块。

Import-Module ActiveDirectory

But above script gives an error as "Import-Module : The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory."但是上面的脚本给出了一个错误,如“Import-Module:未加载指定的模块‘ActiveDirectory’,因为在任何模块目录中都找不到有效的模块文件。” Please help me to fix this issue.请帮我解决这个问题。

You'll need to install the RSAT tools.您需要安装 RSAT 工具。 You can do this by opening an elevated powershell window您可以通过打开升高的 powershell 窗口来执行此操作

DISM.exe /Online /add-capability /CapabilityName:Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 /CapabilityName:Rsat.BitLocker.Recovery.Tools~~~~0.0.1.0 /CapabilityName:Rsat.CertificateServices.Tools~~~~0.0.1.0 /CapabilityName:Rsat.DHCP.Tools~~~~0.0.1.0 /CapabilityName:Rsat.Dns.Tools~~~~0.0.1.0 /CapabilityName:Rsat.FailoverCluster.Management.Tools~~~~0.0.1.0 /CapabilityName:Rsat.FileServices.Tools~~~~0.0.1.0 /CapabilityName:Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0 /CapabilityName:Rsat.IPAM.Client.Tools~~~~0.0.1.0 /CapabilityName:Rsat.LLDP.Tools~~~~0.0.1.0 /CapabilityName:Rsat.NetworkController.Tools~~~~0.0.1.0 /CapabilityName:Rsat.NetworkLoadBalancing.Tools~~~~0.0.1.0 /CapabilityName:Rsat.RemoteAccess.Management.Tools~~~~0.0.1.0 /CapabilityName:Rsat.RemoteDesktop.Services.Tools~~~~0.0.1.0 /CapabilityName:Rsat.ServerManager.Tools~~~~0.0.1.0 /CapabilityName:Rsat.Shielded.VM.Tools~~~~0.0.1.0 /CapabilityName:Rsat.StorageReplica.Tools~~~~0.0.1.0 /CapabilityName:Rsat.VolumeActivation.Tools~~~~0.0.1.0 /CapabilityName:Rsat.WSUS.Tools~~~~0.0.1.0 /CapabilityName:Rsat.StorageMigrationService.Management.Tools~~~~0.0.1.0 /CapabilityName:Rsat.SystemInsights.Management.Tools~~~~0.0.1.0

You need to install the module and it depends on what version of Windows you are using.您需要安装该模块,这取决于您使用的 Windows 版本。 For some versions, it is no longer necessary to install the RSAT tools.对于某些版本,不再需要安装 RSAT 工具。

Here are instructions for various versions - https://adamtheautomator.com/install-powershell-active-directory-module/以下是各种版本的说明 - https://adamtheautomator.com/install-powershell-active-directory-module/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM