< -- BuySellAds Ad Code ALLEN -->

Remove Exchange Mailbox After No Use

If you like to keep your Exchange organization neat and tidy then this power shell script is for you. It allows you to define an amount of days hat a user has not logged in, if the user does not log into the Exchange mailbox in this amount of time then the mailbox is disabled after the set amount of time. First the script then a brief explanation.

***Test this, Its not my fault if it breaks your system!***

 

Get-MailboxStatistics | where {$_.LastLogonTime -lt (get-date).addDays(-90)} | Disable-Mailbox

First we query Exchange for all Mailboxes statistics for the last time the mailbox was logged into. We specify the amount of days as 90 here however you can change the amount of days to your choice.  We query the 90 days against the last log on time, if they time exceeds 90 days then mailboxes that have not logged in in this time are disabled. They will then be deleted in your standard Exchange mailbox purge settings.

This applies to Exchange 2007, Exchange 201 and Exchange 2013

Tags: powershell

Allen White

Allen is an IT Consultant and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5, 6 and HP ASE, AIS - Network Infrastructure.

Leave a comment

Categories

Vote!

What Web Browser Do You Use?

View Results

Loading ... Loading ...

Vote!

What do you prefer..VMware or Hyper-V?

View Results

Loading ... Loading ...