Deleting user accounts
The Active Directory PowerShell module has a cmdlet called Remove-ADUser
to delete user accounts from Active Directory. Alternatively, the Remove-ADObject
cmdlet can be used. The Remove-ADUser
cmdlet is designed to deal with user accounts removal. We will use this cmdlet throughout the examples in this section.
The requests for removal of user accounts increase as the attrition rate increases in your organization. You get requests from HR to delete user accounts on a frequent basis either when an employee leaves the organization or he/she turns down the offer just before joining.
Tip
Most organizations won't delete user accounts when an employee leaves the organization. Instead, they will hide these from the Global Address List/Book (GAL), remove them from all groups, disable the mailbox, and keep the ID in a disabled state. Such accounts can be enabled if the employee rejoins the company later.
Removing a user account from Active Directory is a straightforward...