In this Azure AD tutorial, we will discuss how to fix an error the term ‘get-aduser’ is not recognized as the name of a cmdlet that comes while trying to retrieve users from the Azure active directory.
Recently, I was trying to retrieve the lists of users from my Azure Active Directory using PowerShell. I was executing the Get-aduser PowerShell command as mentioned below.
Get-ADUserAfter executing the above command, I got this get-aduser is not recognized error.
The complete error message was as follows:
get-aduser : The term ‘get-aduser’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- get-aduser
~~- CategoryInfo : ObjectNotFound: (get-aduser: String) [], CommandNotFoundException
- FullyQualifiedErrorId: CommandNotFoundException

Table of Contents
Solution
Try the solutions below to fix your issue.
Solution-1
If you are using Windows 11 or higher versions, then try out this solution.
Open the PowerShell ISE and run the below PowerShell command to install the Active Directory module.
Get-WindowsCapability -Name RSAT.ActiveDirectory* -Online | Add-WindowsCapability -OnlineAfter executing the above PowerShell command, it will start the installation like below

Now, after the successful installation, you will get the below output
PS C:\WINDOWS\system32> Get-WindowsCapability -Name RSAT.ActiveDirectory* -Online | Add-WindowsCapability -Online
Path :
Online : True
RestartNeeded : FalseYou can see the same output in the below screenshot.

Now try running the Get-ADUser PowerShell command. This time, you won’t get any error. If you are still facing the same issue, then try out the below solution.
Solution -2
The first step you need to try out is enabling the Active Directory Module for Windows Powershell feature in your machine. Follow the below steps to enable the Active Directory Module for Windows Powershell option.
- Click on the start menu on your machine and then search for “Windows features.”
- Now, the next step is to click on “Turn Windows features on or off”

3. Then you need to Expand the Remote Server Administration Tools option.
4. Now, Again Expand Role Administration Tools option
5. Then, Expand the AD DS and AD LDS Tools option
6. Make sure to tick the checkbox for Active Directory Module for the Windows Powershell option
7. Now, You need to confirm that it’s okay to install the feature
If the above solution doesn’t work for you, then there is nothing to worry about. Try out the solution below
Solution – 3
- Open the Window PowerShell or PowerShell ISE with Run as Administrator mode.

2. Run the below PowerShell command to find out the path for your PowerShell Profile where it is located.
PS C:\WINDOWS\system32> $profileYou can see that it returned me with the below path
C:\Users\Bijay\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1

3. The next step is to navigate to C:\Users\Bijay\Documents\. You will not find a folder with the name WindowsPowerShell.
Since the folder is not present, create a folder with the name WindowsPowerShell, then you can use the text editor to create a file called Microsoft.PowerShell_profile.ps1 and add the below line
import-module activedirectoryNow, make sure to save the file and then close all your Open PowerShell Sessions. Now, This solution should work for you. You can run the script now. It should not give any error this time.
Solution -4
If you are getting the error that the term ‘get-aduser’ is not recognized as the name of a cmdlet while working in PowerShell in Windows 10, Windows Server 2016 or Windows Server 2012/2012 R2, and the above solutions didn’t work for you then run the below steps to fix it:
Open the Windows command prompt as an administrator and run the below command.
import-module ActiveDirectory
Once you have installed it, you can verify by running the below command:
get-module -listavailableNow, you will not get the error if you will try to execute the Active Directory command get-aduser.
In the case of Windows 10 PowerShell [Solved]
Now, let me tell you the mistake I was making.
A very silly mistake.
I was trying to get users from Azure Active Directory using PowerShell in Windows 10.
In my case, I was using the Active Directory command (get-aduser) rather than the Azure Active Directory command (Get-AzADUser) to retrieve the users from Azure AD.
When I run the below command:
Get-AzADUserNote: We will not have AD configured in the local windows 10 system.
In the case of Windows 2008 server
If you use a Windows 2008 server, follow the steps below to fix the issue.
The first step is, to check if the Azure Active Directory module is present using the below PowerShell cmdlet
PS C:\WINDOWS\system32> get-module -listavailable
Once you run the above command, you should able to see the Azure Active Directory module present on your machine, then run the below PowerShell cmdlet as the next step
PS C:\WINDOWS\system32> import-module activedirectoryIf the Azure Active Directory module is not present and you are using the Windows 2008 server, then before running the above command, you need to install the Azure Active Directory module.
In the case of Windows Server 2008 R2
If you are using Windows Server 2008 R2, then the Azure Active Directory module is by default, present in your machine. You must install it using the below PowerShell cmdlet in the same Order.
Note: Ensure the Active Directory Web Services (ADWS) is installed on your machine.
Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShellOnce you install the Azure Active Directory module on your machine, run the below PowerShell cmdlet.
Check if the Azure Active Directory module is present using the below PowerShell cmdlet
PS C:\WINDOWS\system32> get-module -listavailableThen run the below PowerShell cmdlet as the next step
PS C:\WINDOWS\system32> import-module activedirectoryIn the case of Windows 7
If you are using Windows 7 and you got this error, then below are the steps that can help you to fix the issue.
- 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 Windows Powershell option.
- Finally, click on the OK button to confirm the installation.
Note: One important point to note here is that if you are using Windows 10 and cannot see the “Remote Server Administration Tools” option in your system, then you need to install the RSAT tools for Windows 10 using the below steps.
- Download the Remote Server Administration Tools for Windows 10 now and install it on your machine.
- Once you have installed the RSAT tools, restart your machine once to reflect the changes in your machine. Now, you can enable the Active Directory Module for Windows Powershell option using the above steps.
You may like the following Azure tutorials:
- How to create a user in the Azure active directory
- The term ‘connect-azuread’ is not recognized as the name of a cmdlet function Azure
- The term ‘Get-AzureADDirectorySettingTemplate’ is not recognized as the name of a cmdlet
Wrapping Up
I hope this Azure tutorial helps you to fix the below error on Windows 7, Windows 10, Windows Server 2016, or Windows Server 2012/2012 R2, etc
- The term ‘get-aduser’ is not recognized as the name of a cmdlet
I hope You have enjoyed this Article !!!
I am Bijay, a Microsoft MVP (10 times) having more than 17 years of experience in the software industry. During my IT career, I got a chance to share my expertise in SharePoint and Microsoft Azure, like Azure VM, Azure Active Directory, Azure PowerShell, etc. I hope you will learn from these Azure tutorials. Read more
