Powershell – linked mailbox ADSI Edit

active-directoryadsipowershell

I have a clean up task to do with my Exchange 2003/07 environment. The set-up is as follows:

domain controllers - ( 2003,  2012,  2008)
Domain Function Level is: Windows Server 2003
Server 2003, Exchange 2007 Ent ru15
Co-existence

So some (1000 users) have a linked mailbox in one domain, for the cleanup in ADSI Edit I manually need to check these accounts to ensure msExchRecipientTypeDetails is equal to two, this is the setting for linked mailboxes.

Is it possible to search by get-domainuser for the attribute.

Secondly we have thousands of entries and I can't scroll to them. Does anyone know of a method to search for an object within ADSI if I cannot get a script to work.

Best Answer

To perform a powershell search of all users with the msExchRecipientTypeDetails equal to 2, the following should get you started

Import-module ActiveDirectory get-aduser -filter 'name -like "*" -properties * | where{$_.msExchRecipientTypeDetails -eq 2} | select distinguishedname,msExchRecipientTypedetails | Export-csv LinkedMailboxes.csv

You might want to tweak the filter to narrow your scope based on your environment.
get-help get-aduser -detailed


In regards to showing more entries in ADSIEDIT, you can set the number of items within the filter

  • Adsiedit.msc > right-click "connect to" > eg. Default naming context > OK
  • Left-click to select "Default naming context"
  • View > Filter...
  • Increase the max number of items per container value

Note: It's important to left click to select the "container: Default naming context" or items at that level before your right-click. Otherwise, you get a slightly different set of options that doesn't include view or filters

Related Topic