+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 26
Enterprise Software Thread, Check disabled status of multiple mailboxes (and then Delete them) in Technical; Ive just finished auditing our exchange server, and there are a whole load of old mailboxes from staff who no ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199

    Check disabled status of multiple mailboxes (and then Delete them)

    Ive just finished auditing our exchange server, and there are a whole load of old mailboxes from staff who no longer work here.

    The user accounts are still in AD but they are all disabled. If I just delete the accounts, Im assuming this will delete the mailboxes as well?

    Ive exported a list of all the mailboxes in the Exchange Server.. is there an automated way I can cross reference this with AD, and get a list of the mailboxes whose correspoding AD account is disabled?

    Cheers
    Last edited by RabbieBurns; 26th August 2011 at 06:21 AM.

  2. #2


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    8,921
    Thank Post
    226
    Thanked 2,676 Times in 1,973 Posts
    Rep Power
    787
    Quote Originally Posted by RabbieBurns View Post
    get a list of the mailboxes whose correspoding AD account is disabled?
    No need to cross-reference as you can simply list disabled AD accounts that are mailbox-enabled...

    Code:
    Get-User -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object { $_.UserAccountControl -match 'AccountDisabled' }

  3. Thanks to Arthur from:

    RabbieBurns (31st August 2011)

  4. #3

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199
    I just tried running that but it didnt return any results:

    Code:
    [PS] H:\>Get-User -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object { $_.UserAccountControl -match 'AccountDisabled' }
    [PS] H:\>

  5. #4


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    8,921
    Thank Post
    226
    Thanked 2,676 Times in 1,973 Posts
    Rep Power
    787
    Works fine for me...

    Code:
    [PS] D:\>Get-User -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object { $_.UserAccountControl -match 'AccountDisabled' }
    
    Name                                                        RecipientType
    ----                                                        -------------
    ABC                                                         UserMailbox
    DEF                                                         UserMailbox
    What happens if you run the command shown in red above? Does it list all of your users in AD who are mailbox-enabled?
    Last edited by Arthur; 26th August 2011 at 09:36 AM.

  6. Thanks to Arthur from:

    RabbieBurns (31st August 2011)

  7. #5

    Join Date
    Dec 2008
    Location
    Essex
    Posts
    2,144
    Thank Post
    1
    Thanked 326 Times in 316 Posts
    Rep Power
    77
    1. If you just delete the accounts it wont just delete the mailboxes. What you should do is remove the user from the EMC which will delete the account and mailbox, or if you disable the the mailbox it will just mark the mailbox for deletion and leave the user account alone. Perform these actions via the EMC. Although you can do it via AD, it;s cleaner via EMC.
    2.

  8. Thanks to sukh from:

    RabbieBurns (31st August 2011)

  9. #6

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199
    Quote Originally Posted by Arthur View Post
    Works fine for me...

    Code:
    [PS] D:\>Get-User -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object { $_.UserAccountControl -match 'AccountDisabled' }
    
    Name                                                        RecipientType
    ----                                                        -------------
    ABC                                                         UserMailbox
    DEF                                                         UserMailbox
    What happens if you run the command shown in red above? Does it list all of your users in AD who are mailbox-enabled?
    red command works... full command doesnt...

    @sukh, cheers for the advice of how best to delete... any suggestion on how to determine active / inactive (enabled/disabled Ad accounts) simply?

  10. #7

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199
    this is 2007 exch not 2010, im not sure if ive put 2010 in my posts by accident anwyere

  11. #8

    Join Date
    Dec 2008
    Location
    Essex
    Posts
    2,144
    Thank Post
    1
    Thanked 326 Times in 316 Posts
    Rep Power
    77
    Which AD version you on?

  12. Thanks to sukh from:

    RabbieBurns (31st August 2011)

  13. #9

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199
    2008, but could raise to 2008r2 if needed as all our dc are now 2008r2

  14. #10

    Join Date
    Dec 2008
    Location
    Essex
    Posts
    2,144
    Thank Post
    1
    Thanked 326 Times in 316 Posts
    Rep Power
    77
    1. You can do something like this in AD - do a custom search -

    (&(UserAccountControl:1.2.840.113556.1.4.803:=2)(m sExchHomeServerName=*)(objectClass=User))

    2. Or simply just do a common queries, and select disabled account, then on the results, go to the view and add in the exch server columns

    3. Or if you want to use powershell, quest have some simple and nice add-ins

  15. Thanks to sukh from:

    RabbieBurns (27th August 2011)

  16. #11


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    8,921
    Thank Post
    226
    Thanked 2,676 Times in 1,973 Posts
    Rep Power
    787
    Quote Originally Posted by RabbieBurns View Post
    this is 2007 exch not 2010, I'm not sure if I've put 2010 in my posts by accident anywhere
    I'm using Exchange Server 2010 SP1. Perhaps that's why it works for me?
    Last edited by Arthur; 26th August 2011 at 04:59 PM.

  17. Thanks to Arthur from:

    RabbieBurns (31st August 2011)

  18. #12

    Join Date
    Dec 2008
    Location
    Essex
    Posts
    2,144
    Thank Post
    1
    Thanked 326 Times in 316 Posts
    Rep Power
    77
    Quote Originally Posted by Arthur View Post
    I'm using Exchange Server 2010 SP1. Perhaps that's why it works for me?
    If you do get-user "username" | fl

    does the attribute UserAccountControl get returned in the results? If does then that why, diff exch veriosns

  19. Thanks to sukh from:

    Arthur (26th August 2011)

  20. #13


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    8,921
    Thank Post
    226
    Thanked 2,676 Times in 1,973 Posts
    Rep Power
    787
    Quote Originally Posted by sukh View Post
    3. Or if you want to use powershell, quest have some simple and nice add-ins
    Code:
    Get-QADUser -Disabled
    I know it's not quite the same, but another option might be to use the Get-Mailbox cmdlet to find mailboxes which haven't been accessed within the last 90 days.

    Code:
    $mailboxes = Get-Mailbox -ResultSize Unlimited
    $mailboxes | Where-Object {
      (Get-MailboxStatistics $_).LastLogonTime -and `
      (Get-MailboxStatistics $_).LastLogonTime -le `
      (Get-Date).AddDays(-90)
    }

  21. Thanks to Arthur from:

    RabbieBurns (27th August 2011)

  22. #14


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    8,921
    Thank Post
    226
    Thanked 2,676 Times in 1,973 Posts
    Rep Power
    787
    Quote Originally Posted by sukh View Post
    does the attribute UserAccountControl get returned in the results?
    Yes.

  23. Thanks to Arthur from:

    RabbieBurns (31st August 2011)

  24. #15

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199
    Quote Originally Posted by Arthur View Post
    Code:
    Get-QADUser -Disabled
    I know it's not quite the same, but another option might be to use the Get-Mailbox cmdlet to find mailboxes which haven't been accessed within the last 90 days.

    Code:
    $mailboxes = Get-Mailbox -ResultSize Unlimited
    $mailboxes | Where-Object {
      (Get-MailboxStatistics $_).LastLogonTime -and `
      (Get-MailboxStatistics $_).LastLogonTime -le `
      (Get-Date).AddDays(-90)
    }
    Nice idea with the logon time but it seems we have current staff who havent used the mailbox in a long time

    Where would I find the quest script?

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Live@EDU Delete Multiple Mailboxes
    By napsburypark in forum How do you do....it?
    Replies: 0
    Last Post: 1st August 2011, 03:34 PM
  2. [Video] 3d Printer - Create Functional Objects By Scanning And Then Printing Them
    By DaveP in forum Jokes/Interweb Things
    Replies: 9
    Last Post: 11th July 2011, 03:56 PM
  3. Scripting to Delete multiple files and folders.
    By mdixon123 in forum Scripts
    Replies: 8
    Last Post: 2nd January 2011, 07:28 PM
  4. Exchange 2007. Delete contents of multiple mailboxes
    By PeteM in forum Windows Server 2008
    Replies: 2
    Last Post: 26th May 2010, 11:56 AM
  5. Replies: 9
    Last Post: 10th February 2009, 02:46 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •