[active-directory] Import-Module : The specified module 'activedirectory' was not loaded because no valid module file was found in any module directory

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...

The answer is


This may be an old post, but if anyone is still facing this issue after trying all the above mentioned steps, ensure whether the default path of PowerShell module is specified under the "PSModulePath" environment variable.

The default path should be "%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\"


On Windows 10 - This happened for me after the latest update in 2020.

What solved this issue for me was running the following in PowerShell

C:\>Install-Module -Name MicrosoftPowerBIMgmt


You can install the Active Directory snap-in with Powershell on Windows Server 2012 using the following command:

Install-windowsfeature -name AD-Domain-Services –IncludeManagementTools

This helped me when I had problems with the Features screen due to AppFabric and Windows Update errors.


AD Powershell module should be listed under installed Features. See image:

AD Powershell module should be listed under installed Features. .


Even better use implicit remoting to use a module from another Machine!

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

This will allow you to use the module off a remote PC for as long as the PSSession is connected.

More Information: https://technet.microsoft.com/en-us/library/ff720181.aspx


The ActiveDirectory module for powershell can be installed by adding the RSAT-AD-Powershell feature.

In an elevated powershell window:

Add-WindowsFeature RSAT-AD-PowerShell

or

Enable-WindowsOptionalFeature -FeatureName ActiveDirectory-Powershell -Online -All

Examples related to active-directory

Powershell: A positional parameter cannot be found that accepts argument "xxx" How to switch to another domain and get-aduser How can I verify if an AD account is locked? Powershell script to see currently logged in users (domain and machine) + status (active, idle, away) Querying Windows Active Directory server using ldapsearch from command line How to list AD group membership for AD users using input list? Import-Module : The specified module 'activedirectory' was not loaded because no valid module file was found in any module directory What are CN, OU, DC in an LDAP search? PowerShell script to return members of multiple security groups How do I get specific properties with Get-AdUser

Examples related to windows-server-2008

Multiple -and -or in PowerShell Where-Object statement The FastCGI process exited unexpectedly Import-Module : The specified module 'activedirectory' was not loaded because no valid module file was found in any module directory How can I enable the Windows Server Task Scheduler History recording? IIS7: A process serving application pool 'YYYYY' suffered a fatal communication error with the Windows Process Activation Service Gradle proxy configuration Installing Tomcat 7 as Service on Windows Server 2008 How to get current user who's accessing an ASP.NET application? ASP.Net which user account running Web Service on IIS 7? A process crashed in windows .. Crash dump location

Examples related to powershell-2.0

Extract the filename from a path Out-File -append in Powershell does not produce a new line and breaks string into characters Using PowerShell to remove lines from a text file if it contains a string PowerShell The term is not recognized as cmdlet function script file or operable program Can't install nuget package because of "Failed to initialize the PowerShell host" Powershell script to see currently logged in users (domain and machine) + status (active, idle, away) How to export data to CSV in PowerShell? powershell is missing the terminator: " PowerShell script to check the status of a URL How to upgrade PowerShell version from 2.0 to 3.0