If your Windows environments have migrated to Exchange 2007, you know that the use of the Exchange Management Shell has become a critical part of system administration. One of the topics that go along with de-provisioning an account is how to handle the email account.

For some environments, you can retain the Windows account for a new hire once the email account is archived. With Exchange 2007, this task would require the use of the shell interface to retain the account and remove the email attributes. The other action would be the full removal of the Windows account and the Exchange mailbox. This functionality is important, as some organisations do not provide all employees' email.

To remove the email attribute from the Windows account yet retain the account, you can run either of these scripts from an Exchange Management Shell environment:

disable-mailbox -Identity Windows.Username

disable-mailbox email.address@company.com

This will remove the Exchange mailbox attributes from the account and remove the mailbox from the database. Some additional parameters can be added to the command, such as specifying the domain controller to write the changes to the user account objects and to be confirmed of each change before it is committed.

The other scenario for scripting the removal of the Exchange mailbox would also remove the Windows account from Active Directory. This is a more permanent task, and it is more common when there is no need to retain the Windows account. Both of the samples below show how to do this:

remove-mailbox -Identity User.Name

remove-mailbox user.name@company.com

The two scenarios can be scripted out in large amounts with normal batch files. A common way to make these scripts is a concatenated formula within an Excel spreadsheet that requires only the username or email address to be added to create the command, which would be copied and pasted to save or run in the Exchange Management Shell.

Serverside This was published in Serverside, check every Tuesday for more stories

Related links

Leave a comment

You must read and type the 6 chars within 0..9 and A..F

* indicates mandatory fields.

Log in


Sign up | Forgot your password?

  • Staff Apple to developer: Fart jokes aren't funny

    When Apple announced it would be vetting every application submitted for inclusion in the App Store, this was just the kind of question that entered many a mind: just how arbitrary would the company be in wielding that veto power? Read more »

    -- posted by Staff

  • Staff Chrome is just another browser

    Hands up if you missed the Chrome release -- didn't think anyone did. Google's browser arrived with all the fanfare and hype that only Google can produce. Read more »

    -- posted by Staff

  • Renai LeMay 2Vouch refers well

    Melbourne-based Web start-up 2Vouch yesterday launched the first public beta of what it dubs its "social recruiting platform". Read more »

    -- posted by Renai LeMay

What's on?