Humm, the list looks good to me. Here is how the Imanami RUS works:
Program flow:
1. Autodetect the forest and domains. This setting is user configurable. The user can specify which forest or domain to process but the account the service runs under must have permissions within that forest or domain.
2. Is Exchange 2007 installed in the forest? If yes then go to 3. If no then End and notify the user.
3. Are the Exchange 2007 Administration Tools installed? If yes then go to 4. If no then End and notify the user. We need the admin tools to fix the recipients.
4. For each domain discovered:
a. Find all improperly provisioned recipients (mailbox-enabled users, mail-enabled users, mail-enabled contacts and mail-enabled groups).
Note: If the Exchange 2003 RUS is present the script will only process mailbox-enabled users, it will not process mail-enabled recipients such as mail-enabled users, contacts and group. The Exchange 2003 RUS will process those recipients correctly. See the Exchange Team blog for administration co-existence:
http://msexchangeteam.com/archive/2006/10/09/429135.aspx
i. Mailbox-Enabled Users
"(&(objectClass=User)(objectCategory=Person)(mailNickname=*)(!msExchVersion=*)(homeMDB=$databaseDN))"
Note: The homeMDB=$databaseDN predicate ensures only mailboxes on the specified Exchange 2007 database are returned.
ii. Mail-Enabled Users
“(&(objectClass=User)(objectCategory=Person)(mailNickname=*)(!msExchVersion=*)(targetaddress=*)(!msExchALObjectVersion=*))”
Note: The !msExchangeALObjectVersion=* predicate prevents the query from returning objects that have already been processed by the Exchange 2003 RUS.
iii. Mail-Enabled Contacts
"(&(objectClass=Contact)(objectCategory=Person)(mailNickname=*)(!msExchVersion=*)(targetaddress=*)(!msExchALObjectVersion=*))”
Note: The !msExchangeALObjectVersion=* predicate prevents the query from returning objects that have already been processed by the Exchange 2003 RUS.
iv. Mail-Enabled Groups
(&(objectClass=Group)(objectCategory=Group)(mailNickname=*)(!msExchVersion=*)(displayname=*)(!mail=*)(!msExchALObjectVersion=*))"
Note: The !msExchangeALObjectVersion=* predicate prevents the query from returning objects that have already been processed by the Exchange 2003 RUS.
b. For each recipient from 4a:
i. Fix the recipient.
Note: we cannot call an Exchange 2007 cmdlet to fix the recipient (such as Set-Mailbox –ApplyMandatoryParameters) because Exchange 2007 will not recognize the recipient created by Imanami products.
1. Verify the recipient needs fixing (IsValidMailbox(), IsValidMailUser(), etc.).
2. Save the following attribute values which are required to re-provision the recipient in step 4.b.i.4:
a. Mailbox-Enabled Users
· DistinguishedName for the Identity parameter.
· MailNickName for the Alias parameter.
· HomeMDB for the Database parameter.
b. Mail-Enabled Users
· DistinguishedName for the Identity parameter.
· MailNickName for the Alias parameter.
· Targetaddress for the ExternalEmailAddress parameter.
c. Mail-Enabled Contacts
· DistinguishedName for the Identity parameter.
· MailNickName for the Alias parameter.
· Targetaddress for the ExternalEmailAddress parameter.
d. Mail-Enabled Groups
· DistinguishedName for the Identity parameter.
· MailNickName for the Alias parameter.
· DisplayName for the DisplayName parameter.
3. Clear all Exchange related attributes. Required for step 4bi4.
· mailnickname
· homemdb
· homemta
· mDBUseDefaults
· mail
· proxyAddresses
· msexchversion
· msExchALObjectVersion
· legacyExchangeDN
· msExchMailboxGuid
· msExchMailboxSecurityDescriptor
· msExchPoliciesIncluded
· msExchRecipientDisplayType
· targetAddress
· mAPIRecipient
· internetEncoding
4. Call the appropriate Exchange 2007 cmdlet to provision the object correctly (Enable-Mailbox, Enable-MailUser, etc.).
a. Mailbox-Enabled Users
Enable-Mailbox -Identity '$identity' -Alias '$alias' -Database '$homeMDB'
b. Mail-Enabled Users
Enable-MailUser -Identity "$identity" -Alias "$alias" -ExternalEmailAddress "$targetaddress"
c. Mail-Enabled Contacts
Enable-MailContact -Identity $identity -Alias $alias -ExternalEmailAddress $targetaddress
d. Mail-Enabled Groups
Enable-DistributionGroup -Identity "$identity" -Alias "$alias" -DisplayName "$display"
ii. Write to the event log which recipient was fixed and how it was fixed (which attributes where removed and which command was called).
5. Wait 10 seconds. This setting is user configurable. You could set it for 10 minutes if you want.
6. Go to step 1 and start all over, you never know when a new recipient will show up.
Let's turn on debug messages and see what's happening. Edit the ImanamiRUS.ps1 file and locate this line:
$debug = $false;
change it to:
$debug = $true;
Restart the Imanami RUS service and then check the event log - don't be suprised if you see a ton of new messages. Each step int he above process will have a message in the event log. I noticed that you are populating targetAddress. TargetAddress is only for mail-enabled objects (contacts and users) not mailbox enabled objects. An object cannot have both homemdb and targetAddress specified, Exchange will get confused. Can you remove this attribute from the job?