The Get-ADUser PowerShell cmdlet is very helpful for Active Directory user management. But what if you try to use Get-ADUser and get the error below?
The term ‘Get-ADUser’ is not recognized as the name of a cmdlet, function, script file or operable program.
This error simply means that the Active Directory module for PowerShell is not available on your machine. This module is installed by default on domain controllers, if you want to use PowerShell remotely, you need to install the module on your machine.
Read on to learn how to install the Active Directory module on Windows 10 or Windows Server and then import it to your current session so you can run Get-ADUser without getting an error message.
Step 1: Install the PowerShell Active Directory Module
Installing PowerShell on Windows 10
The Windows PowerShell cmdlets are included in the Windows Remote Server Administration Tools (RSAT). To install RSAT on Windows 10 version 1809 or later, use the following command:
Get-WindowsCapability -Name RSAT.ActiveDirectory* -Online | Add-WindowsCapability -Online
If you are running an earlier version of Windows, you will need to download and install RSAT manually.
Installing PowerShell on Windows Server
The procedures for installing PowerShell on Windows Server are the same across all the following versions:
- Windows Server 2019
- Windows Server 2008 and 2008 R2
- Windows Server 2012 and 2012 R2
- Windows Server 2016
You can use either of the following two methods.
Method 1: Install using the Wizard
- In the Start menu, Navigate to Start?and then?Server Manager.
- Click Manage in the upper right corner and then choose Add Roles & Features.
- If the wizard displays a Before you Begin?dialog, click Next.
- Select Role-based or Feature-based Installation and click Next.
- Click the Select a Server from the Server pool?option and choose your server. Click Next.
- On the?Server Roles?page, no changes are required, so simply click Next.
- On the Features?page, expand?Remote Server Administration Tools ? Role Administration Tools ? AD DS and AD LDS Tools, andclick Active Directory Module for Windows PowerShell. Then click Next.
- On the Confirmation?page, click Install. When the installation is complete, click Close.
Method 2: Install using PowerShell
- Click Start and search for “PowerShell”. Choose “Windows PowerShell”?from the search results.
- Install the PowerShell AD module by running the Install-WindowsFeature cmdlet. To add child features, be sure to include the parameters shown here:
Install-WindowsFeature -Name “RSAT-AD-PowerShell” -IncludeAllSubFeature
Step 2: Import the Active Directory PowerShell Module
Once the module is installed, you need to add it to your current session. The following steps are valid for both Windows 10 and all Windows Server versions:
- Click Start and search for “PowerShell”. Choose?WindowsPowerShell?from the search results.
- Run the following command to verify that the module is available on your system:
Get-Module -Name ActiveDirectory -ListAvailable
- Import the module using the?Import-Module?cmdlet as follows:
Import-Module -Name ActiveDirectory
Next Steps
Now that you have installed and imported the Active Directory PowerShell module, you can avoid the dreaded “Get-ADUser Not Recognized” error.