The Active Directory (AD) module lets you manage users, computers, and other AD objects easily from PowerShell.
0
0
AD module installation in PowerShell
Introduction
You want to create or delete AD users without opening the AD console.
You need to automate password resets for many users.
You want to check which computers are in your AD domain.
You need to add users to AD groups quickly using a script.
Syntax
PowerShell
Install-WindowsFeature -Name RSAT-AD-PowerShell Import-Module ActiveDirectory
Install-WindowsFeature installs the AD module on Windows Server.
Import-Module ActiveDirectory loads the module so you can use its commands.
Examples
Installs and loads the AD module on Windows Server.
PowerShell
Install-WindowsFeature -Name RSAT-AD-PowerShell Import-Module ActiveDirectory
Loads the AD module if already installed.
PowerShell
Import-Module ActiveDirectory
Installs the AD module on Windows 10 or 11 using Windows capabilities.
PowerShell
Get-WindowsCapability -Name RSAT.ActiveDirectory* -Online | Add-WindowsCapability -Online
Sample Program
This script installs the AD module, loads it, and then lists the first 3 AD users with their names and usernames.
PowerShell
Install-WindowsFeature -Name RSAT-AD-PowerShell
Import-Module ActiveDirectory
Get-ADUser -Filter * -ResultSetSize 3 | Select-Object Name, SamAccountNameOutputSuccess
Important Notes
On Windows 10/11, use Add-WindowsCapability instead of Install-WindowsFeature.
You need to run PowerShell as Administrator to install the module.
After installation, always import the module before using AD commands.
Summary
The AD module lets you manage Active Directory from PowerShell.
Use Install-WindowsFeature on servers or Add-WindowsCapability on Windows 10/11 to install it.
Always import the module with Import-Module ActiveDirectory before running AD commands.