Powershell Needful Things put that in your pipeline

Exchange 2007 User Cleanup

The Exchange 2007 user mailbox cleanup tool, is a free tool which Exchange Administrators can use to cleanup stale or unused mailboxes from Exchange 2007 mailbox servers.

The tool is executed as a Powershell script which opens up a GUI interface. The reason for the GUI is to allow Exchange server administrators to delegate this function to the recipient administrators without a huge learning curve.

When you launch the tool, you select the mailbox server against which you want to run a query or cleanup. Once you have selected your server, you can select any of the predetermined queries, to help you locate user mailboxes to remove. These are:

Disabled - Mailboxes linked to disabled Active Directory accounts.
Hidden - Mailboxes which are hidden from the Global Address List.
Stale - Mailboxes linked to Active Directory accounts which have not logged on in 90 days.

Once the query is complete, the results are listed with a calculation of the approximate size of the accounts. You can now shift-click or control-click to select accounts against which you want to perform cleanup actions.

The following actions are available:

Export list - Export the list of users to a text file, as a backup or to submit change control requests
Export PST - This exports the mailboxes you have selected to PST. You need to have Outlook installed with the Exchange Management tools for this to work.
Rename - Rename the accounts based on the query used to find the, (DISABLED-XXX, or HIDDEN-XXX etc.)
Disable - Disable the mailbox, removing the mailbox and Active Directory association.
Delete - Delete the mailbox, leaving the Active Directory account in tact.
Move - Move the selected mailboxes to a "mothball" store for backup and removal.

Finally, there is a check box called "Go Live". None of these actions will have any impact on your environment unless this box is checked. This box removes the whatif parameter from the action buttons.

I am continually adding new features and functionality to the script, so subscribe for updates, or check in regularly for new versions.

CHANGE LOG
------------
V1.3 (Final)
Added one more search query button, the “Last Logon” button. This button will look for users on the selected server where the LastLogon is equal to $null. This finds accounts which have essentially never logged on. There is a small bug though, if the user name is not unique, it seems that the last logon is unreadable and the account will also show up in the list.

V1.2
After completing a query, the utility will now show you the total amount of data used by the mailboxes. (this obviously ignores single instance storage etc.)
You can now use the utility to move selected mailboxes to another store
I have force removed the mandatory “confirm” on the Exchange verbs (move, disabled and delete)

V1.0
Basic GUI with all features enabled.

WARNING: This is a dangerous utility, and can wreck your Exchange system if you are not careful. Please test this in your test environment first, and adhere to your change control procedures before using this utility in the live environment. I take absolutely no responsibility for any damage caused by using this tool. The utility requires the Exchange Management shell, and if launched from a Vista / Windows 7 needs to be “Run as Administrator”

If you like this script and use it in production, please help me keep this project free by considering a small donation.





The script can be downloaded from here: