Introduction
Managing an on-prem Active Directory (AD) environment can be challenging, but using PowerShell commands for Active Directory helps simplify many common tasks. Whether it’s Active Directory user management, group handling, or managing organizational units, PowerShell provides powerful tools for automating these tasks. In this blog, we’ll cover 20 essential PowerShell commands that every system administrator should know to streamline Active Directory management with PowerShell.
Why Use PowerShell for Active Directory?
Using PowerShell commands in Active Directory offers several benefits such as speed, automation, and flexibility. Tasks like user creation, password management, and group administration, which would take several steps in the GUI, can be completed with a single command. Additionally, it allows for bulk operations and detailed filtering, making Active Directory management with PowerShell both efficient and scalable.
Also check: Top 50 PowerShell Commands for Daily Use
Prerequisites: Installing the Active Directory PowerShell Module
First, ensure that the Active Directory module for PowerShell is installed:
Install-WindowsFeature -Name RSAT-AD-PowerShellImport the module using:
Import-Module ActiveDirectory20 PowerShell Commands for Active Directory Administration

1. Creating a New User in Active Directory
New-ADUser -Name "John Doe" -GivenName "John" -Surname "Doe" -SamAccountName "jdoe" -UserPrincipalName "jdoe@domain.com" -Path "OU=Users,DC=domain,DC=com" -AccountPassword (ConvertTo-SecureString "P@ssw0rd!" -AsPlainText -Force) -Enabled $trueCreates a new user in AD with the necessary attributes.
2. Getting User Details
Get-ADUser -Identity jdoe -Properties *Retrieves detailed information about a specific user account.
3. Modifying User Attributes
Set-ADUser -Identity jdoe -Title "IT Manager" -Department "IT"Modifies user attributes like title and department.
4. Resetting User Password
Set-ADAccountPassword -Identity jdoe -NewPassword (ConvertTo-SecureString "NewP@ssw0rd" -AsPlainText -Force)Resets a user’s password.
5. Disabling a User Account
Disable-ADAccount -Identity jdoeDisables a user account.
6. Enabling a User Account
Enable-ADAccount -Identity jdoeEnables a previously disabled user account.
7. Adding a User to a Group
Add-ADGroupMember -Identity "GroupName" -Members jdoeAdds a user to a specific AD group.
8. Removing a User from a Group
Remove-ADGroupMember -Identity "GroupName" -Members jdoe -Confirm:$falseRemoves a user from a group without prompting for confirmation.
9. Listing All AD Users
Get-ADUser -Filter *Retrieves a list of all users in the Active Directory.
10. Finding Disabled User Accounts
Search-ADAccount -AccountDisabledLists all disabled user accounts in AD.
11. Finding Locked-Out User Accounts
Search-ADAccount -LockedOutFinds all locked-out user accounts in AD.
12. Unlocking a User Account
Unlock-ADAccount -Identity jdoeUnlocks a locked user account.
13. Moving a User to a Different OU
Move-ADObject -Identity "CN=John Doe,OU=Users,DC=domain,DC=com" -TargetPath "OU=Managers,DC=domain,DC=com"Moves a user to a different organizational unit (OU).
14. Deleting a User Account
Remove-ADUser -Identity jdoePermanently deletes a user account from AD.
15. Listing All AD Groups
Get-ADGroup -Filter *Lists all Active Directory groups.
16. Creating a New AD Group
New-ADGroup -Name "Managers" -GroupScope Global -GroupCategory Security -Path "OU=Groups,DC=domain,DC=com"Creates a new security group in AD.
17. Modifying Group Membership
Set-ADGroup -Identity "Managers" -ManagedBy "CN=Admin,OU=Users,DC=domain,DC=com"Changes the group’s manager.
18. Listing Group Members
Get-ADGroupMember -Identity "GroupName"Retrieves the members of a specific AD group.
19. Creating an Organizational Unit (OU)
New-ADOrganizationalUnit -Name "IT Department" -Path "DC=domain,DC=com"Creates a new organizational unit.
20. Getting Group Policy Information
Get-GPO -AllLists all Group Policy Objects (GPOs) in your domain.
Suggested Read: Essential Network Ports for Active Directory, DNS, DHCP, and ADFS
Conclusion
These 20 essential PowerShell commands will help system administrators streamline their Active Directory management with PowerShell. Whether you’re handling Active Directory user management, group membership, or troubleshooting accounts, these commands will make daily tasks faster and more efficient. Take advantage of these PowerShell commands for Active Directory to improve your workflow and automate repetitive tasks.
Also Read: 5 Valid Reasons for Moving to Azure AD Domain Services
External Reference
Microsoft Docs: Active Directory Cmdlets in Windows PowerShell
- Why should you automate Active Directory cleanup? - 17 June 2025
- Troubleshooting: Unable to Add Instance Failover Group to Azure SQL Managed Instance - 4 March 2025
- 10 Azure Virtual Desktop (AVD) Cost-Optimization Strategies for 2025 💡💰 - 22 February 2025



