Get-aduser not recognized

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

After 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
get-aduser not recognized

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

After executing the above PowerShell command, it will start the installation like below

get-aduser : the term 'get-aduser' is not recognized as the name of a cmdlet

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 : False

You can see the same output in the below screenshot.

the term get-aduser is not recognized

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.

  1. Click on the start menu on your machine and then search for “Windows features.”
  2. Now, the next step is to click on “Turn Windows features on or off”
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.

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

  1. Open the Window PowerShell or PowerShell ISE with Run as Administrator mode.
powershell get-aduser not recognized

2. Run the below PowerShell command to find out the path for your PowerShell Profile where it is located.

PS C:\WINDOWS\system32> $profile

You can see that it returned me with the below path

C:\Users\Bijay\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1