Delete inactive mailboxes
I'm new to exchange and would like to delete all mailboxes from my system that haven't been accessed for say, 6 months. Is there an easy way, or even a complicated way to do this? Thanks In Advance.
June 24th, 2011 10:47am

1. Depending on how you have configured your mailbox database, these should be deleted automatically to a setting called "Keep deleted mailboxes for" , not sure what version of exch youre using but you will find this on the properties of the mailbox database onthe limits tabs. 2. If the mailboxes have been deleted (from the user account), then you will have to do this 1st. 3. Not sure what version of exch you're using but you can use get-mailboxstatistics to get info when the mailbox was last logged onto. Sukh
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2011 11:49am

Use get-mailboxstatistics, here's a snippet from my quarterly account\mailbox cleanup. Perform Active Mailbox Audit a.Open both the spreadsheets and copy the Pre-W2K Namename's from both spreadsheet into a new spreadsheet called mailboxaudit.csv. Edit mailboxaudit.csv so that the first entry on the spreadsheet b.Open Exchange Powershell import-csv "C:\Admin\scripts\Active Directory Account Cleanup\AuditReports Q2 March 16 2011\mailboxaudit.csv" | Foreach-object {get-mailboxstatistics $_.user} |FL displayname, lastlogontime, lastloggedonuseraccount > "C:\Admin\scripts\Active Directory Account Cleanup\AuditReports Q2 March 16 2011\mailboxauditresults.txt" c.Review the mailboxauditresults.txt, ignore any mailboxes if access is older than 90 days. Also ignore any access from serviceaccountA (due to backup service account). Since this can cause false positives with service accounts overwriting the lastloggedonuseraccount you may have to resort to disabling any services that log in for a week (whateve fits your fancy) to see if anyone else is logging in. For the remainder if you see mailboxes being accessed within the 90 days, go into Exchange right click the mailbox click manage full access permission. Verify if the user has access to the disabled mailbox. Reason being, the access can be false positives due to calendar availability lookups. If you find that the user has access then follow up with the user to determine if access is still required. If it's still required, export the disabled mailbox to pst and provide him the pst. Once you've filtered the list you can do a bulk disable. Create csv file file.csv Name jchong bsmith Import-CSV c:\temp\file.csv | ForEach-Object -Process {disable-Mailbox $_.Name} James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
June 24th, 2011 8:56pm

Hi, 1. List all the mailbox and save as CSV. Get-MailboxStatistics -server "YourServerName" | Where {($_.LastLogonTime -gt (get-date).adddays(-90))} | ft DisplayName >List.csv 2. Import-CSV c:\temp\List.csv | ForEach-Object -Process {disable-Mailbox $_.Name} Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2011 3:56am

Thanks for all your answers. And the "disable" will delete the actual mailbox? TIA
July 6th, 2011 4:21am

The "disable" will disconnect the mailbox from the user (delete) but it wont actually be deleted straight away. See Point 1 in my 1st post. Eventually it will according to the sertting.Sukh
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2011 4:27am

Thanks once again. On a slightly different tangent, if I had a csv file of the mailboxes I wanted to deleted, how easy would it be to delete those, rather than doing it one, by one?
July 6th, 2011 8:55am

select the all mailboxes and delete in console.Chandru CT. MCITP
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2011 9:52am

Thanks
July 11th, 2011 5:57am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics