How to delete a user account in Active Directory using PowerShell scripts?
Read on to know how to delete an Active Directory (AD) user account using PowerShell and how you can get it done easier with ADManager Plus, a comprehensive Active Directory management solution. Read on to know how to delete an Active Directory (AD) user account using PowerShell and how you can get it done easier with ADManager Plus, a comprehensive Active Directory management solution.
- Identify the domain in which the AD account to be deleted is located.
- Create and compile the script for deleting the AD account. Execute the script in PowerShell.
- Sample script to delete an AD User account:
Click to copy entire script
PS C:\> Remove-ADUser -Identity 4b6be1f4-cb58-4d81-ba2f-de88663948a8
- Navigate to Management > User Management > Bulk User Management > Delete Users.
- Select the Domain and the User Account(s) you wish to delete. You can even import this list from a CSV file. Then click Apply.
» Start 30-day Free Trial
Although deleting an AD user account with native tools like PowerShell looks simple, it comes with a few limitations:
- PowerShell script can be run only from the computers which have the Active Directory Domain Services role installed in them.
- The syntax, parameters and iterations need to be correct. A typo or incorrect syntax might be difficult to spot and rectify especially when the script is a long one.
- Inability to delegate the deletion of AD accounts to help desk technicians.
- Impossible to configure deletion policies for AD accounts. For example, ADManager Plus lets you set conditions for what happens when you delete an AD account like deleting the linked G Suite, Office 365 accounts also automatically, removing associated licenses and mailboxes, deleting home folders and more.
ADManager Plus helps you perform the same with a few clicks from its web-based GUI console with pre-defined reports to list all users and delete them right from the reports. It also has options for automating removal of inactive AD accounts. Learn more about it here.