active directory basic PowerShell command

Active Directory (AD) is a directory service developed by Microsoft for managing users, groups, computers, and other resources in a networked environment. PowerShell is a powerful scripting and automation tool that can be used to manage Active Directory. Here are some basic PowerShell commands and tasks for managing Active Directory:

Note: To run Active Directory-related PowerShell commands, you typically need to have the Active Directory module installed and be a member of the appropriate Active Directory security groups. Additionally, ensure that you are running PowerShell with administrative privileges.

Get information about a specific user

Get-ADUser -Identity username

Create a new user

New-ADUser -Name “John Doe” -SamAccountName “johndoe” -UserPrincipalName “johndoe@yourdomain.com” -Path “OU=Users,DC=yourdomain,DC=com” -AccountPassword (ConvertTo-SecureString “Password123” -AsPlainText -Force) -Enabled $true

Reset a user’s password

Set-ADAccountPassword -Identity username -NewPassword (ConvertTo-SecureString “NewPassword123” -AsPlainText -Force)

Disable a user account

Disable-ADAccount -Identity username

Enable a user account

Enable-ADAccount -Identity username

Add a user to a group

Add-ADGroupMember -Identity “GroupName” -Members “username”

Remove a user from a group

Remove-ADGroupMember -Identity “GroupName” -Members “username”

Search for users based on specific criteria

Get-ADUser -Filter {Name -like “John*”}

Create a new group

New-ADGroup -Name “NewGroup” -GroupScope Global -GroupCategory Security



These are some basic PowerShell commands for managing Active Directory. You can perform a wide range of tasks using PowerShell, from user management to group management and more, depending on your specific requirements. Always exercise caution and follow best practices when making changes to your Active Directory environment.


By amit_g

Welcome to my IT Infra Blog! My name is Amit Kumar, and I am an IT infrastructure expert with over 11 years of experience in the field. Throughout my career, I have worked with a wide variety of systems and technologies, from network infrastructure and cloud computing to hardware and software development. On this blog, I aim to share my knowledge, insights, and opinions on all things related to IT infrastructure. From industry trends and best practices to tips and tricks for managing complex systems, my goal is to provide valuable information that will help IT professionals and enthusiasts alike. Whether you are a seasoned IT veteran or just getting started in the field, I hope you will find my blog to be a valuable resource. In addition to sharing my own thoughts and ideas, I also welcome feedback, comments, and questions from my readers. I believe that a collaborative approach is the best way to advance the field of IT infrastructure and I look forward to hearing from you. Thank you for visiting my blog, and I hope you will continue to follow along as I explore the fascinating world of IT infrastructure. Sincerely, Amit Kumar

Leave a Reply

Your email address will not be published. Required fields are marked *