Powershell scripts cannot be run in multiple domain controller
Hello, We have the below scripts to be running to reset the legacyexchangedn for the external contacts. We have 4 DCs and 1 DC are located in other location. They are replicating each other during the contacts created. updatelegacy.ps1 Import-Module ActiveDirectory $mail = "vlv2012@company.org" New-MailContact -Name "VLV 2012" -ExternalEmailAddress $mail -FirstName VLV -LastName 2012 -OrganizationalUnit "OU=TESTOU,dc=company,dc=org" -Alias vlv2012 -PrimarySmtpAddress $mail $oldvalue = "/o=companyorganication/ou=Exchange Administrative Group (FYDIBOHF23345)/cn=Recipients/cn=VLV20122" $newledarray = Get-MailContact -Identity $mail -OrganizationalUnit "OU=TESTOU,dc=company,dc=org" $newnew = $newledarray.legacyexchangedn Get-ADObject -Filter {mail -eq $mail} | Set-ADObject -Remove @{legacyexchangedn=$newnew} Get-ADObject -Filter {mail -eq $mail} | Set-ADObject -Replace @{legacyexchangedn=$oldvalue} However, the legacyexchangedn can not be updated, it will still using the original one which is created by the New-MailContact command. Do anyone know how can I resolve this issue? Thanks, VLV2012
April 3rd, 2012 5:47am

Hi, What is the error output when you run those cmdlet? Please post here. Besides, please try to force DC to replica.Xiu Zhang TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2012 2:37am

The script is all wrong, first if the contact already exists you can't do new-mailcontact again. Second you haven't declared the alias variable. Third what is the purpose of setting a new legacyexchangedn? James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
April 4th, 2012 10:48am

hi VLV2012, could you please try this ............ Get-ADObject -Filter {mail -eq $mail} -properties * | Set-ADObject -clear legacyexchangedn Get-ADObject -Filter {mail -eq $mail} -properties * | Set-ADObject -add @{legacyexchangedn=$oldvalue} . . . ./ . .Thanks Joseph Pradeep =========================================================== If you found this post helpful, please give it a "Helpful" vote. If it answered your question, remember to mark it as an "Answer".
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2012 11:22am

The script is all wrong, first if the contact already exists you can't do new-mailcontact again. Second you haven't declared the alias variable. Third what is the purpose of setting a new legacyexchangedn? James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com Hi James, Exchange 2010 SP1 will append the random char to the end of the legacyexchangedn. If the user uses the name cacned from the outlook, they may get the error return email message said that the legacyexchangedn is wrong and not able to deliver the email to external user. We have to set the legacyexchangedn to resolve this issues.
April 4th, 2012 9:35pm

Hi, What is the error output when you run those cmdlet? Please post here. Besides, please try to force DC to replica. Xiu Zhang TechNet Community Support There have no error output, I can run the command to update the legacyexchangedn value manually from the powershell.
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2012 9:51pm

hi VLV2012, could you please try this ............ Get-ADObject -Filter {mail -eq $mail} -properties * | Set-ADObject -clear legacyexchangedn Get-ADObject -Filter {mail -eq $mail} -properties * | Set-ADObject -add @{legacyexchangedn=$oldvalue} . . . ./ . . Thanks Joseph Pradeep =========================================================== If you found this post helpful, please give it a "Helpful" vote. If it answered your question, remember to mark it as an "Answer". Hi Joseph, I have tried your command and it didn't work....The legacyexchangedn value are still not updating...
April 4th, 2012 9:52pm

Hi, Please have a look at the article below: Exchange 2007, legacyExchangeDN and mail-enabled user conversions http://mostlyexchange.blogspot.com/2007/08/exchange-2007-legacyexchangedn-and-mail.html This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.Xiu Zhang TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2012 10:00pm

I guess I'm not exactly quite sure why you still need to swap it, unless you're doing the recipient conversion or some migration. In either case I'll give you the quick and dirty method. Use admodify and do a custome bulk operation with the custom attribute. Set the custom attribute to legacyexchangedn and for the value you add "/o=companyorganication/ou=Exchange Administrative Group (FYDIBOHF23345)/cn=Recipients/cn==%'alias'%" Keep in mind that if outlook users have emailed the contact before and it had the old legacyexchangedn they will get a bounce back since you now updated it with the new value. James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
April 4th, 2012 11:04pm

I guess I'm not exactly quite sure why you still need to swap it, unless you're doing the recipient conversion or some migration. In either case I'll give you the quick and dirty method. Use admodify and do a custome bulk operation with the custom attribute. Set the custom attribute to legacyexchangedn and for the value you add "/o=companyorganication/ou=Exchange Administrative Group (FYDIBOHF23345)/cn=Recipients/cn==%'alias'%" Keep in mind that if outlook users have emailed the contact before and it had the old legacyexchangedn they will get a bounce back since you now updated it with the new value. James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com Our boss didn't want the user to clear their autocomplete list (name cached). We have to keep the original legacyexchangedn value for the updated external mail contacts. (we have a operations tasks to update the external mail contacts from other company) Also we cannot use alias as the value as it may have the same alias in the environment and the emails may deliver to the people who has the same alias. That's why exchange 2010 SP1 has a feature to add the random char to the end of the legacyexchangedn to prevent this issues happen.
Free Windows Admin Tool Kit Click here and download it now
April 5th, 2012 1:33am

Hi, Please have a look at the article below: Exchange 2007, legacyExchangeDN and mail-enabled user conversions http://mostlyexchange.blogspot.com/2007/08/exchange-2007-legacyexchangedn-and-mail.html This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. Xiu Zhang TechNet Community Support Hi Xiu, The X500 works. However, I cannot update the EmailAddresses with using ps1 files scripts. It will have the error message even though I have the primarysmtpaddress with using new-mailcontacts. However, if I issue the Set-MailContact -Identity vlv2012@company.org -EmailAddresses 'SMTP:vlv2012@company.org','X500:Test' command in the exchange powershell manually, it works without issues There is no primary SMTP address. + CategoryInfo : NotSpecified: (company.org/TestOU/VLV2012:ADObjectId) [Set-MailContact], DataVa lidationException + FullyQualifiedErrorId : DAAF347C,Microsoft.Exchange.Management.RecipientTasks.SetMailContact If I hard code the command (For example:Set-MailContact -Identity vlv2012@company.org -EmailAddresses 'SMTP:vlv2012@company.org','X500:Test' ) in the ps1 file, it will get the below error The proxy address "SMTP:vlv2012@company.org" is already being used by "company.org/TestOU/vlv2012". Pleas e choose another proxy address. + CategoryInfo : NotSpecified: (company.org/TestOU/VLV2012:ADObjectId) [Set-MailContact], Proxy AddressExistsException + FullyQualifiedErrorId : FCCC0B3D,Microsoft.Exchange.Management.RecipientTasks.SetMailContact
April 5th, 2012 2:13am

The below is the part of the scripts. All $mail, $company, $alias, etc will get from files $ledarray = Get-MailContact -Identity $mail -OrganizationalUnit "OU=TestOU,dc=company,dc=org" $legacyExchangeDN2 = $ledarray.legacyexchangedn New-MailContact -Name $displayName -ExternalEmailAddress $mail -FirstName $firstname -LastName $lastname -OrganizationalUnit "OU=TestOU,dc=company,dc=org" -Alias $alais -PrimarySmtpAddress $mail $mailX500 = "'X500:" + $legacyExchangeDN2 + "','SMTP:" + $mail + "'" Get-MailContact -Identity $mail -OrganizationalUnit "OU=TestOU,dc=company,dc=org" | Set-Contact -Company $company -Title $title -Phone $telephone -Department $department Set-MailContact -Identity $mail -EmailAddresses $mailX500
Free Windows Admin Tool Kit Click here and download it now
April 5th, 2012 2:20am

Sorry I still don't understand the scenario. You have 1 external contact already called vlv2012 with the smtp address of vlv2012@company.org with a legacydn of "/o=companyorganication/ou=Exchange Administrative Group (FYDIBOHF23345)/cn=Recipients/cn=VLV20122XYX (random characters). Users are currently emailing to this external contact which has the old legacyexchangedn. Now from this point what are you needing to accomplish? Are you converting the external contact to a mailbox and need to preserve the old legacydn as per the article? James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
April 5th, 2012 10:12am

Sorry I still don't understand the scenario. You have 1 external contact already called vlv2012 with the smtp address of vlv2012@company.org with a legacydn of "/o=companyorganication/ou=Exchange Administrative Group (FYDIBOHF23345)/cn=Recipients/cn=VLV20122XYX (random characters). Users are currently emailing to this external contact which has the old legacyexchangedn. Now from this point what are you needing to accomplish? Are you converting the external contact to a mailbox and need to preserve the old legacydn as per the article? James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com Actually, we have around 10000 contacts on our site and our boss didn't want the user to do anything. The possible way is to keep the original legacyexchangedn (with random char) or add the X500 with old letgacyexchagendn (with random char) value to the external contacts. It seems that exchange powershell cannot do a one shot for this case....I may need to seperate the other scripts to reset the legacyexchangedn value.
Free Windows Admin Tool Kit Click here and download it now
April 9th, 2012 5:24pm

Hi, Please have a look at the article below: Exchange 2007, legacyExchangeDN and mail-enabled user conversions http://mostlyexchange.blogspot.com/2007/08/exchange-2007-legacyexchangedn-and-mail.html This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. Xiu Zhang TechNet Community Support Hi Xiu, The X500 works. However, I cannot update the EmailAddresses with using ps1 files scripts. It will have the error message even though I have the primarysmtpaddress with using new-mailcontacts. However, if I issue the Set-MailContact -Identity vlv2012@company.org -EmailAddresses 'SMTP:vlv2012@company.org','X500:Test' command in the exchange powershell manually, it works without issues There is no primary SMTP address. + CategoryInfo : NotSpecified: (company.org/TestOU/VLV2012:ADObjectId) [Set-MailContact], DataVa lidationException + FullyQualifiedErrorId : DAAF347C,Microsoft.Exchange.Management.RecipientTasks.SetMailContact If I hard code the command (For example:Set-MailContact -Identity vlv2012@company.org -EmailAddresses 'SMTP:vlv2012@company.org','X500:Test' ) in the ps1 file, it will get the below error The proxy address "SMTP:vlv2012@company.org" is already being used by "company.org/TestOU/vlv2012". Pleas e choose another proxy address. + CategoryInfo : NotSpecified: (company.org/TestOU/VLV2012:ADObjectId) [Set-MailContact], Proxy AddressExistsException + FullyQualifiedErrorId : FCCC0B3D,Microsoft.Exchange.Management.RecipientTasks.SetMailContact Hi, The scripit was written by Jim Mulvey, I found it from http://social.technet.microsoft.com/forums/en-US/exchangesvradmin/thread/6b4ec4dd-8150-4acb-a89c-d6f1d04507f9/ Maybe he will get more idea on your thread.Xiu Zhang TechNet Community Support
April 9th, 2012 10:58pm

Hi, Please have a look at the article below: Exchange 2007, legacyExchangeDN and mail-enabled user conversions http://mostlyexchange.blogspot.com/2007/08/exchange-2007-legacyexchangedn-and-mail.html This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. Xiu Zhang TechNet Community Support Hi Xiu, The X500 works. However, I cannot update the EmailAddresses with using ps1 files scripts. It will have the error message even though I have the primarysmtpaddress with using new-mailcontacts. However, if I issue the Set-MailContact -Identity vlv2012@company.org -EmailAddresses 'SMTP:vlv2012@company.org','X500:Test' command in the exchange powershell manually, it works without issues There is no primary SMTP address. + CategoryInfo : NotSpecified: (company.org/TestOU/VLV2012:ADObjectId) [Set-MailContact], DataVa lidationException + FullyQualifiedErrorId : DAAF347C,Microsoft.Exchange.Management.RecipientTasks.SetMailContact If I hard code the command (For example:Set-MailContact -Identity vlv2012@company.org -EmailAddresses 'SMTP:vlv2012@company.org','X500:Test' ) in the ps1 file, it will get the below error The proxy address "SMTP:vlv2012@company.org" is already being used by "company.org/TestOU/vlv2012". Pleas e choose another proxy address. + CategoryInfo : NotSpecified: (company.org/TestOU/VLV2012:ADObjectId) [Set-MailContact], Proxy AddressExistsException + FullyQualifiedErrorId : FCCC0B3D,Microsoft.Exchange.Management.RecipientTasks.SetMailContact Hi, The scripit was written by Jim Mulvey, I found it from http://social.technet.microsoft.com/forums/en-US/exchangesvradmin/thread/6b4ec4dd-8150-4acb-a89c-d6f1d04507f9/ Maybe he will get more idea on your thread. Xiu Zhang TechNet Community Support Thanks Xiu, I think I will follow the below steps and implement to my scripts to achieve the goal. I do think this is the multiple domain controller issue as I have no problems on my testing environment (Only 1 DC) 1. Export the current LegacyExchagendn value from the existing external contacts 2. Re-import all contacts from external party 3. Use separate AD scripts to read the step 1 files and reset the legacyexchangedn 4. run the repadmin /syncall /e /A /P /q to replicate the changes to all DCs
Free Windows Admin Tool Kit Click here and download it now
April 11th, 2012 10:56pm

Welcome to post here if you get any update~~~Xiu Zhang TechNet Community Support
April 11th, 2012 11:00pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics