The term ‘get-aduser’ is not recognized as the name of a cmdlet in Windows 10 PowerShell

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 in Windows 10 PowerShell that comes while trying to retrieve users from Azure active directory.

The term ‘get-aduser’ is not recognized as the name of a cmdlet in Windows 10 PowerShell

The error comes as the term ‘get-aduser’ is not recognized as the name of a cmdlet in Windows 10 PowerShell.

Powershell: The term ‘Get-ADUser’ is not recognized as the name of a cmdlet

The full error was coming as:

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
the term 'get-aduser' is not recognized windows 10
get aduser not recognized

get-aduser is not recognized as the name of a cmdlet powershell [Solved]

Solution -1

If you are getting the error “The term ‘Get-ADUser’ is not recognized as the name of a cmdlet, function, script file, or operable program” or “get aduser not recognized”. Then you can try out the below solutions.

get aduser is not recognized [Solved]

The first step you need to try out is, You need to enable 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 in your machine and then search for “windows features”
  2. 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 AD DS and AD LDS Tools option
  6. Make sure to tick the checkbox for Active Directory Module for Windows Powershell option
  7. Now, You need to Confirm that it’s okay to install the feature

If the above solution didn’t work for you, then nothing to worry, try out the below solution

get aduser not recognized [Solved]

Solution – 2

  1. Open the Window PowerShell or PowerShell ISE with Run as Administrator mode
get aduser not recognized
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 able to see, it returned me with the below path

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

powershell get-aduser not recognized
get-aduser : the term ‘get-aduser’ is not recognized as the name of a cmdlet

3. The next step is, 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 activedirectory

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

Get-ADUser not recognized [Solved]

Solution – 3

If you are getting the error 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, then run the below steps to fix it:

Open Windows command prompt as an administrator and run the below command.

import-module ActiveDirectory

Once you installed it, you can verify by running the below command:

get-module -listavailable

Now you will not get the error if you will try to execute the Active Directory command get-aduser.

The term ‘get-aduser’ is not recognized as the name of a cmdlet windows 10 PowerShell [Solved]

Now, let me tell you the mistake I was doing.

A very silly mistake.

I was trying to get users from Azure Active Directory using PowerShell in Windows 10.

And 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-AzADUser

Note: We will not have AD configured in the local windows 10 system.

So this is How you can able to fix the error “get aduser not recognized” or “The term ‘get-aduser’ is not recognized.” by following any of the solutions mentioned above.

The term ‘get-aduser’ is not recognized as the name of a cmdlet   (Windows 2008 server) [Solved]

If you are using Windows 2008 server and you got The term ‘get-aduser’ is not recognized as the name of a cmdlet, then below are the steps that can help you to fix the issue.

The first step is, check if the Azure Active Directory module is present using the below PowerShell cmdlet

PS C:\WINDOWS\system32> get-module -listavailable

Once, you will 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 activedirectory

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

The term ‘get-aduser’ is not recognized as the name of a cmdlet   (Windows Server 2008 R2) [Solved]

if you are using Windows Server 2008 R2, then the Azure Active Directory module is by default present in your machine, you will have to install it using the below PowerShell cmdlet in the same Order.

Note: Make sure that the Active Directory Web Services (ADWS) is installed on your machine.

Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell

Once, you will install the Azure Active Directory module in 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 -listavailable

Then run the below PowerShell cmdlet as the next step

PS C:\WINDOWS\system32> import-module activedirectory

The term ‘get-aduser’ is not recognized as the name of a cmdlet   (Windows 7) [Solved]

If you are using Windows 7 and you got The term ‘get-aduser’ is not recognized as the name of a cmdlet, then below are the steps that can help you to fix the issue.

  1. Navigate to the Control Panel and open it -> click on the Programs and Features -> Turn On/Off Windows Features
  2. Then you need to find out “Remote Server Administration Tools” and expand it.
  3. Now, Expand the “Role Administration Tools” node.
  4. Then, Expand AD DS and AD LDS Tools option.
  5. Make sure to tick the checkbox for Active Directory Module for Windows Powershell option
  6. Finally, click on the OK button to confirm the installation.

Note: One important point to note down here is, If you are using Windows 10 and you are not able to 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.

  1. Download the Remote Server Administration Tools for Windows 10 now and install it on your machine.
  2. Once you have installed the RSAT tools, make sure to restart your machine once so that the changes will be reflected in your machine. Now you should be able to enable the Active Directory Module for Windows Powershell option using the above steps.

Get aduser

Description

Whenever there is a requirement to find out Active Directory (AD) users in your domain, Get-Aduser PowerShell command can help you to quickly find the AD users in your domain.

Syntax:

Get-ADUser [-AuthType <ADAuthType>][-Credential <PSCredential>]-Filter <String>[-Properties <String[]>][-ResultPageSize <Int32>][-ResultSetSize <Int32>][-SearchBase <String>][-SearchScope <ADSearchScope>][-Server <String>][<CommonParameters>]
Get-ADUser [-AuthType <ADAuthType>][-Credential <PSCredential>][-Identity] <ADUser>
[-Partition <String>][-Properties <String[]>][-Server <String>][<CommonParameters>]

There are some Prerequisites needed to work with Get-Aduser PowerShell command.

Prerequisites

Below are some Prerequisites needed to work with the Get-Aduser PowerShell command

  • You must log in with an AD user account
  • Make sure, you have the PowerShell Active Directory module installed on your machine

There are different ways to use the Get-Aduser PowerShell command

Find User Account With Identity

The Identity parameter helps you to retrieve the user quickly from your domain and the only thing is you need to know the name of the user that you have to send as a parameter along with the Get-AdUser PowerShell cmdlet.

You can use different parameters like Name, SAMAccountName, SID and GUID, etc.

Example:

PS C:\WINDOWS\system32> Get-ADUser -Identity Bijay

Or

PS C:\WINDOWS\system32> Get-ADUser -Identity 'T-l-7-21-58745555-3432493942-33333458655-5166'

Or

PS C:\WINDOWS\system32> Get-ADUser -Identity 'CN=Bijay,OU=HR,DC=HRC,DC=local

Get-ADUser With Filter

If you don’t know the name and if you want to retrieve the user based on some filter condition then you can use the -Filter and LDAPFilter parameter. You can use different identifiers like the Where-Object and givenName, etc.

Example

PS C:\WINDOWS\system32> Get-AdUser -Filter "givenName -eq 'Bijay'"

Get-AdUser With Properties Parameter

You can also use the Get-AdUser with the Properties Parameter. The Property parameter can be used with one or more comma-delimited attributes. You can also use the Property parameter with the givenName.

ExampleGet all of the properties for a specific user

Get-AdUser -Filter "givenName -eq 'Bijay'" -Properties *

Get-AdUser with OU

You can also use the Get-AdUser to filter by OU and for that, you need to use the SearchBase  parameter with the Get-AdUser command. The SearchBase helps you to begin the search for a user account for a specific OU and it accepts the distinguished name (DN) of the OU.

Example

PS> Get-ADUser -Filter * -SearchBase 'OU=TsinfoUsers,DC=domain,DC=local'

Using the Filter of * means, it will match all user accounts.

List all Domain Users

You can list down all the domain users using the asterisk as parameter * along with the Get-AdUser PowerShell cmdlet. The syntax will be like below

Get-ADUser -Filter *

Get All Properties

We can also able retrieve all the attributes of the Ad user using the below PowerShell command.

PS> Get-ADUser -Filter * -Properties *

Get-AdUser with Get-Help

You can get all the Parameter details of the Get-AdUser PowerShell command using the Get-Help command along with the Get-AdUser command. The syntax will be like below

Help Get-AdUser

Get-AdUser Export To CSV File

If you want to make a report of the list of users in a CSV file. You can use the below PowerShell cmdlet to export the list of users to a CSV file quickly.

PS> Get-ADUser -Filter "*" | Export-CSV -Path TestUsers.csv

List Only Enabled Users using Get-AdUser

you can get the list of the users who having AD user ID enabled or the list of active users using the below PowerShell cmdlet.

PS> Get-ADUser -Filter {Enabled -eq $True}

You may like following Azure tutorials:

Wrapping Up

I hope this Azure tutorial, helps us to fix the below errors 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 windows 10.
  • get-aduser is not recognized as the name of a cmdlet PowerShell.
  • The term ‘get-aduser’ is not recognized as the name of a cmdlet, function, script file, or operable program.
  • get aduser not recognized
  • get aduser is not recognized
  • Powershell: The term ‘Get-ADUser’ is not recognized as the name of a cmdlet
  • Power shell command not working in Power shell ISE
  • The term ‘get-aduser’ is not recognized.
  • Powershell get aduser not recognized
  • get-aduser is not recognized
  • get-aduser not recognized
  • Get-AdUser: Finding Active Directory users with PowerShell

Hope, You have enjoyed this Article !!!