Exchange: Find Disabled Accounts with Mailboxes
Summary: In this example we will use a customer AD query to search for disabled accounts with mailboxes.
Example 1.
In this example we will perform a custome AD search using Active Directory Users and Computers
1. Open Active Directory Users and Computers and click the find icon
2. In the "Find" drop down menu, select custom search and click the advanced tab
3. Paste the following in the white pane:
(&(UserAccountControl:1.2.840.113556.1.4.803:=2)(msExchHomeServerName=*)(objectClass=User))
This will enumerate all disabled accounts with mailboxes. From here you can delete all the mailboxes by selecting the first user and scolling down to the bottom of the list and selecting the last user by shift + left click. Then right click the list, Exchange tasks and delete mailbox.
To perform a search of a single server:
(&(UserAccountControl:1.2.840.113556.1.4.803:=2)(msExchHomeServerName=/O=Domain/OU=MyOU/cn=Configuration
/cn=Servers/cn=Exservername)(objectClass=User))
Click find.
To obtain the full dn of your msExchHomeServerName attribute, you can find this in ADSIEdit.
1. Go to start run, type adsiedit.msc (part of windows server support tools)
2. Expand Domain, this should resemble your OU structure. Locate a user, right click a user cn=my user and select properties.
3. Look for attribute msExchHomeServerName and double click. Copy this string and paste it in the above Ldap query.
Other tricks:
Find disabled accounts with mailboxes that are not hidden in the GAL.
(&(UserAccountControl:1.2.840.113556.1.4.803:=2)(msExchHomeServerName=*)(!msExchHideFromAddressLists=TRUE)(objectClass=User))
To export to txt file using LDIFDE from command prompt:
C:\>ldifde -f c:\exportlist.txt -r "(&(UserAccountControl:1.2.840.113556.1.4.803
:=2)(msExchHomeServerName=*)(!msExchHideFromAddressLists=TRUE)(objectClass=User)
)" -l "dn"
Best practices:
Ensure that you have deleted Mailbox retention configured to ensure that these mailboxes can be recovered in a swift manner. To configure mailbox retention, open Exchange System Manger, locate your mailbox store, properties limits tab.
James Chong (MVP)MCSE M+, S+, MCTS, Security+
msexchangetips.blogspot.com
How useful was this article? Want to see a tip not listed? Please leave a comment.
Example 1.
In this example we will perform a custome AD search using Active Directory Users and Computers
1. Open Active Directory Users and Computers and click the find icon
2. In the "Find" drop down menu, select custom search and click the advanced tab
3. Paste the following in the white pane:
(&(UserAccountControl:1.2.840.113556.1.4.803:=2)(msExchHomeServerName=*)(objectClass=User))
This will enumerate all disabled accounts with mailboxes. From here you can delete all the mailboxes by selecting the first user and scolling down to the bottom of the list and selecting the last user by shift + left click. Then right click the list, Exchange tasks and delete mailbox.
To perform a search of a single server:
(&(UserAccountControl:1.2.840.113556.1.4.803:=2)(msExchHomeServerName=/O=Domain/OU=MyOU/cn=Configuration
/cn=Servers/cn=Exservername)(objectClass=User))
Click find.
To obtain the full dn of your msExchHomeServerName attribute, you can find this in ADSIEdit.
1. Go to start run, type adsiedit.msc (part of windows server support tools)
2. Expand Domain, this should resemble your OU structure. Locate a user, right click a user cn=my user and select properties.
3. Look for attribute msExchHomeServerName and double click. Copy this string and paste it in the above Ldap query.
Other tricks:
Find disabled accounts with mailboxes that are not hidden in the GAL.
(&(UserAccountControl:1.2.840.113556.1.4.803:=2)(msExchHomeServerName=*)(!msExchHideFromAddressLists=TRUE)(objectClass=User))
To export to txt file using LDIFDE from command prompt:
C:\>ldifde -f c:\exportlist.txt -r "(&(UserAccountControl:1.2.840.113556.1.4.803
:=2)(msExchHomeServerName=*)(!msExchHideFromAddressLists=TRUE)(objectClass=User)
)" -l "dn"
Best practices:
Ensure that you have deleted Mailbox retention configured to ensure that these mailboxes can be recovered in a swift manner. To configure mailbox retention, open Exchange System Manger, locate your mailbox store, properties limits tab.
James Chong (MVP)MCSE M+, S+, MCTS, Security+
msexchangetips.blogspot.com
How useful was this article? Want to see a tip not listed? Please leave a comment.

7 Comments:
Hi there,
Nice stuff you got, very interesting to read.
Well, I do have also in my sleeves, if you have time don't forget to visit
bookoftips.blogspot.com
Many thanks
Very Useful
Thanks
Nid
I like Archlord gold very much. Since I entered into this game, I learnt skills to earn Archlord money. Thanks to archlord online Gold let me know a lot of friends. It is my habit to buy Archlord gold, and I get some cheap Archlord gold from my friends and Internet.
I like to play Asda Story, because I like its name, also I like Asda Story gold. My friend told me that she would buy Asda Story money for me, and I was so happy. I do not like to go shopping, because it always spends a lot of money, but I never hesitate to buy Asda Story Gold. You can buy cheap Asda Story gold; it is so easy and convenient.
I like play online game, I also Buy metin2 gold and Metin2 gold, the Metin2 yang is very cheap, and use the Cheap metin2 yang can buy many things, I like Cheap metin2 gold, thanks, it is very good.
I like play online game, I also Buy Perfect World Gold and Perfect World Gold, the Perfect World Silver is very cheap, and use the Perfect World money can buy many things, I like cheap Perfect World Gold, thanks, it is very good.
got some spam in the comments on this post just fyi.
The Hogan scarpe
reminds to the spring’s pure coolers. Have a look at our fashion store online where you can find the Hogan scarpe donna
. The modern atmosphere of the hogan donna
campaign is not only in the items used. Among the many interesting points he made was that Hogan scarpe uomo
swing was very difficult to copy.
It can't truly work, I think this way.
Post a Comment
<< Home