44

I am having trouble doing an import-module ActiveDirectory on a Server 2008 SP2 (64 bit).

  • NET Framework 3.5 SP1 is installed
  • I download the Windows6.0-KB968934-x86.msu (for ADWS)
  • This file did not install saying that "The update does not apply to my system"
  • Doing some research (http://anti-american.rssing.com/chan-2091246/all_p15.html) I installed hotfix in KB article 969166 and the above update installed.
  • After a reboot, I noticed that in services, Active Directory Web Services is running
  • I opened an administrative PS prompt and performed an Import-Module ActiveDirectory, but...

...I get:

Import-Module : The specified module 'activedirectory' was not loaded because no valid     module file was found in any module directory.
At line:1 char:14
+ import-module <<<<  activedirectory
    + CategoryInfo          : ResourceUnavailable: (activedirectory:String) [Import-    Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

If its any help, here's some info in PSModule Path, modules and the version:

PS C:\Windows\system32> $env:PSModulePath
C:\Users\ischmd\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

PS C:\Windows\system32> Get-Module -ListAvailable

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   BitsTransfer              {}
Manifest   PSDiagnostics             {}

PS C:\Windows\system32> $PSVersionTable.psversion

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1


PS C:\Windows\system32> $host.version

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1

Any help is greatly appreciated. The main purpose of this is to GET-AdUser command to automate some process but at this point, were stumped. My only conclusion is that this is not possible with Windows 2008 SP2...

4

8 回答 8

35

AD Powershell 模块应列在已安装的功能下。见图片:

AD Powershell 模块应列在已安装的功能下。.

于 2013-10-04T17:11:22.737 回答
28

对于非服务器,这需要适用于 Windows 的远程服务器管理工​​具 __

于 2016-01-20T23:10:29.903 回答
13

ActiveDirectory可以通过添加该RSAT-AD-Powershell功能来安装 powershell的模块。

在提升的 powershell 窗口中:

Add-WindowsFeature RSAT-AD-PowerShell

或者

Enable-WindowsOptionalFeature -FeatureName ActiveDirectory-Powershell -Online -All
于 2016-10-14T17:36:42.293 回答
11

您可以使用以下命令在 Windows Server 2012 上安装带有 Powershell 的 Active Directory 管理单元:

安装-windowsfeature -name AD-Domain-Services –IncludeManagementTools

当我因 AppFabric 和 Windows 更新错误而出现功能屏幕问题时,这对我很有帮助。

于 2015-06-25T13:07:31.560 回答
1

更好地使用隐式远程处理来使用另一台机器的模块!

$s = New-PSSession Server-Name
Invoke-Command -Session $s -ScriptBlock {Import-Module ActiveDirectory}
Import-PSSession -Session $s -Module ActiveDirectory -Prefix REM

只要 PSSession 已连接,这将允许您在远程 PC 上使用该模块。

更多信息: https ://technet.microsoft.com/en-us/library/ff720181.aspx

于 2016-11-23T00:23:09.027 回答
1

在 Windows 10 上 - 这发生在我 2020 年的最新更新之后。

为我解决这个问题的是在 PowerShell 中运行以下命令

C:\>Install-Module -Name MicrosoftPowerBIMgmt
于 2020-05-14T19:58:54.513 回答
0

这可能是一个旧帖子,但如果有人在尝试了上述所有步骤后仍然面临这个问题,请确保在PSModulePath环境变量下指定了 PowerShell 模块的默认路径。

默认路径应该是%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\

于 2019-07-16T11:07:59.297 回答
0

如果您的计算机上没有安装 Active Directory 模块,则需要为您的操作系统下载正确的远程服务器管理工​​具 (RSAT) 包。

https://docs.microsoft.com/en-US/troubleshoot/windows-server/system-management-components/remote-server-administration-tools#rsat-for-windows-10-platform-and-tools-support-矩阵

如果您运行的是 Windows 10,则可以从此处下载适用于 Windows 10 更新的远程服务器管理工​​具https://www.microsoft.com/en-us/download/details.aspx?id=45520

安装后,使用提升的 PowerShell 运行“import-module ActiveDirectory”。

于 2021-03-08T12:36:13.380 回答