In this PowerShell Azure tutorial, we will discuss how to fix the error. The specified module ‘ActiveDirectory’ was not loaded because no valid module file was found in any module directory, which I got while trying to import the ActiveDirectory module using the Azure PowerShell cmdlet.
Table of Contents
Import-module : the specified module ‘ActiveDirectory’ was not loaded because no valid module file was found in any module directory.
Recently, while working with Azure PowerShell, I was trying to import the Active Directory module, and I got this error. I was executing the below PowerShell cmdlet.
PS C:\WINDOWS\system32> Import-Module ActiveDirectoryYou can see once I ran the above PowerShell cmdlet, I got the above error.

The complete error message was as below
Import-Module: The specified module ‘ActiveDirectory’ was not loaded because no
valid module file was found in any module directory.
At line:1 char:1
- Import-Module ActiveDirectory
~~~~~~~~~- CategoryInfo : ResourceUnavailable: (ActiveDirectory: String) [Import-M
odule], FileNotFoundException - FullyQualifiedErrorId: Modules_ModuleNotFound, Microsoft.PowerShell.Commands. Im
portModuleCommand
- CategoryInfo : ResourceUnavailable: (ActiveDirectory: String) [Import-M
Solution
You can follow the below steps to fix this error.
Solution -1:
1. Run the Windows PowerShell or PowerShell ISE in “Run as administrator” mode.

2. Check if the Active Directory Web Services is running on your machine. If it is stopped, you need to start it. You must search for services.msc to find the Active Directory Web Services status.
3. Now, run the below command to check if the Active Directory module is present on your machine.
PS C:\WINDOWS\system32> Get-module -list4. Then, You can use the below PowerShell cmdlet to enable the Active Directory module.
PS C:\WINDOWS\system32> Add-WindowsFeature RSAT-AD-PowerShellSolution -2:
Case-1:
In case you are using a Windows Operating System, You can also try out the below steps to install the Azure Active Directory module, which will fix this issue
- Please navigate to the Control Panel and open it -> click on the Programs and Features -> Turn On/Off Windows Features
- Then, you need to find out “Remote Server Administration Tools” and expand it.
- Now, Expand the “Role Administration Tools” node.
- Then, Expand the AD DS and AD LDS Tools options.
- Make sure to tick the checkbox for Active Directory Module for the Windows Powershell option
- Finally, click on the OK button to confirm the installation.
Now, you can run the Import command to import the Azure Active Directory module.
Case-2:
If you are using Windows server 2012 R2 and are trying to install the ActiveDirectory module but cannot, then you can follow the information below to install the active directory module.
1. Run the Windows PowerShell or PowerShell ISE in “Run as administrator” mode.

2. Then, run the below PowerShell cmdlet.
Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShellYou may also like to follow the below article
- The Specified Module ‘AzureRM’ Was Not Loaded
- The term ‘get-azuresubscription’ is not recognized
- The ‘Set-AzContext’ command was found in the module ‘Az. Accounts’ but the module could not be loaded.
Wrapping Up
Well, in this article, we have discussed how to fix the error. The specified module ‘ActiveDirectory’ was not loaded. I hope it will help you to fix your issue as well !!!

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
