Active Directory Account and Exchange Mailbox Cleanup Procedures

Active Directory Account and Exchange Mailbox Cleanup Procedures

As part of regular account maintenance, Active Directory user accounts and Exchange 2010 mailboxes of previous staff should be deleted from the system after a period of time. Below are the steps required to perform this clean up.

Note: some steps can be skipped depending on what activity is required.

In general, the cleanup steps are below:

  • Perform AD Account/Mailbox Inventory
  • Export Mailboxes to PST
  • Remove ex-staff’s AD Account and Mailbox


 Perform AD Account/Mailbox Inventory

  1. Go to Active Directory Users and Computers (ADUC) – ExStaff OU and review the accounts.
  2. Open Exchange Management Shell (EMS) and determine the mailbox sizes using the below cmdlet (Note: this is one long command)
Get-Mailbox -OrganizationalUnit "ou=ExStaff,dc=XXXXX,dc=com" | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize,Database
  1. Check with the ex-staff’s manager what to do with the mailbox
  • Review email addresses assigned to ex-staff and any email forwarding that is set
  • Decide on what to do: Just delete? Assign alias to manager/other staff before delete?


Export mailboxes to PST

  1. Ensure there’s enough free space in the disk partition of the server that will store the PSTs (eg shared as \\server1\psts$)
  1. Open EMS and run the mailbox export request cmdlet below to export the mailbox.
New-MailboxExportRequest –Mailbox joe.bloggs –FilePath \\server1\pst$\Joe.Blogss.pst
  1. Get mailbox export request status using the below cmdlet.

Or, to get the % completion use the below cmdlet.

Get-MailboxExportRequest | Get-MailboxExportRequestStatistics


  1. When the mailbox export request is completed the request remains on the server until it is removed. Complete the mailbox export request using the cmdlet below.
Get-MailboxExportRequest | where {$_.status -eq "Completed"} | Remove-MailboxExportRequest


Remove ex-staff’s AD Account and Mailbox

  1. Get a screenshot of the current Database Size and White Space Size of all databases using the cmdlet below.
Get-MailboxDatabase -Status | ft Name,DatabaseSize,AvailableNewMailboxSpace -auto
  1. Use the below cmdlet to remove BOTH the Exchange mailbox and the user account from Active Directory. Note this step is irreversible.

Remove-Mailbox –identity joe.bloggs –permanent $true


  1. After a minute, run the cmdlet in Step 1 again to see if the white space space has increased.


4. Backup (or Delete) the user’s Home Directory



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s