Skip to main content
SysAdmin Shell Scripting Essentials

PowerShell Install Module Active Directory via RSAT Guide

powershell install module active directory installs the Active Directory PowerShell module via RSAT using Add-WindowsCapability or Install-WindowsFeature, not from the PowerShell Gallery.

Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 -Online

Syntax

# Windows 10 version 1809+ / Windows Server 2019+
Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 -Online

# Windows 10 pre-1809 / Windows Server 2016 and earlier
Install-WindowsFeature -Name "RSAT-AD-PowerShell" -IncludeAllSubFeature

# Verify installation in any PowerShell session
Get-Module -Name ActiveDirectory -ListAvailable

# Import the module after installation
Import-Module ActiveDirectory

Tested on Windows 10 Pro 22H2 (build 19045) with RSAT Active Directory tools version 10.0.19041.1 and Windows Server 2022 Standard.

Options and Flags

Command / Flag Type Default Description
Add-WindowsCapability -Name Required N/A Specifies the RSAT capability package for Active Directory DS/LDS tools – target string includes version 0.0.1.0.
Add-WindowsCapability -Online Switch Not present Downloads and installs the capability from Windows Update. Required for remote/windows 10 1809+.
Install-WindowsFeature -Name Required N/A Name of the feature – use "RSAT-AD-PowerShell" on Server OS or pre-1809 Windows 10.
Install-WindowsFeature -IncludeAllSubFeature Switch Not present Installs all dependent sub-features (AD DS and AD LDS tools).
Get-Module -ListAvailable Switch Not present Lists all available modules matching the name; returns $true if ActiveDirectory module is installed.
Import-Module -Name Required N/A Imports the module into the current session – without this, cmdlets like Get-ADUser are unavailable.
See also  dscacheutil -flushcache: macOS DNS Flush Troubleshooting

Usage Examples

Example 1: Install on Windows 10 version 1809+ (or Windows 11)

# Run from an elevated PowerShell prompt (Admin)
Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 -Online

Downloads and installs the Active Directory PowerShell module via Windows Update. Requires internet access. After completion, run Get-Module -Name ActiveDirectory -ListAvailable to confirm.

Example 2: Install on Windows Server (any version) or Windows 10 pre-1809

# Server Manager equivalent; works on Nano Server if RSAT is supported
Install-WindowsFeature -Name "RSAT-AD-PowerShell" -IncludeAllSubFeature

Uses DISM underneath. On Server Core, this command installs the module without a GUI. Verify with Get-WindowsFeature -Name RSAT-AD-PowerShell | Select-Object Installed.

Example 3: Import the module from a remote workstation

# After successful installation, import into current session
Import-Module ActiveDirectory

# Verify cmdlets are available
Get-Command -Module ActiveDirectory | Select-Object Name

The ActiveDirectory module must be imported each new session unless added to your profile ($PROFILE). For PowerShell 7, import with -UseWindowsPowerShell flag (module is Windows PowerShell only).

Troubleshooting & Common Errors

Error Message / Code Root Cause Resolution Command
"The requested operation requires elevation" PowerShell not run as Administrator Close and reopen PowerShell as Administrator: right‑click → Run as Administrator
"Add-WindowsCapability : failed" with WS_1803 Windows Update service disabled or offline Run Start-Service wuauserv then retry the Add-WindowsCapability command
"Get-Module : The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory." RSAT not installed or module path not scanned Verify installation with Get-Module -ListAvailable -Name ActiveDirectory; if empty, reinstall RSAT
"Import-Module : Could not load type 'System.DirectoryServices' from assembly." PowerShell 7 without explicit Windows PowerShell compatibility Use Import-Module ActiveDirectory -UseWindowsPowerShell

Frequently Asked Questions

What is the difference between Add-WindowsCapability and Install-WindowsFeature for installing the Active Directory module?

Answer: Add-WindowsCapability is used on Windows 10 version 1809+ and Windows Server 2019+ to install the RSAT capability via Windows Update. Install-WindowsFeature is used on earlier versions (pre-1809 Windows 10 and Windows Server 2016 or older) and on Server OS versions. Both install the same module, but the command depends on the OS version.

See also  Echo $$ Linux Command Reference: Syntax, Flags & Use Cases

Why does Get-Module -ListAvailable not show the ActiveDirectory module after installation?

Answer: The module may require a reboot to appear. If not present after reboot, re-run the installation command. Verify with Get-WindowsCapability -Name Rsat* -Online | Where-Object Name -like '*ActiveDirectory*'.

Does the Active Directory module work on PowerShell Core (macOS/Linux)?

Answer: No. The ActiveDirectory module depends on Windows-specific libraries (ADSI, .NET Framework). Cross-platform management requires WinRM remoting to a Windows domain controller: Invoke-Command -ComputerName DC01 -ScriptBlock { Import-Module ActiveDirectory; Get-ADUser -Filter * }.