-->

Friday, September 5, 2014

Exchange 2010 Bulk Removing Mailboxes

My ongoing project to clean up Inactive accounts/mailboxes is now at the mailbox removal point. I'll show you how to use PowerShell to import a CSV list of user aliases and remove (delete) those mailboxes in one shot.
Keep in mind, removing a mailbox deletes the mailbox and AD account, which is different from disabling mailboxes, which only removes the Exchange attributes, but leaves the account in AD and leaves the mailbox in the DB until the retention period passes.

First, create a CSV of aliases that you need to remove, with "Name" as the heading of the column, and filename of aliases.csv.

**Note** If you already have a list of display names, you can follow my previous post to create a new CSV with just the aliases.

Next, fire up the EMS (Exchange Management Shell), and run:

Import-Csv c:\aliases.csv | Foreach {Remove-Mailbox –Confirm: $false –Identity $_.Name}

**Note** Change the path of the aliases.csv to wherever you saved it

Easy as that! Check your EMC and those accounts will be gone.

1 comment: