Bonjour,
Je rencontre un problème à l’exécution du script-ci dessous censé recréer dans une organisation Exchange 2010 les "contacts" homonymes de nos boites aux lettres Exchange 2007 à travers la relations d'approbation entre les
deux forêts.
Lors de l’exécution le un message d'erreur s'affiche qui dit:
Accès au service liste d'adresse sur tous les serveurs Exchange 2007 a été refusé ...
voici le code:
Add-PSSnapin Quest.ActiveRoles.ADManagement
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
clear
$Error.Clear()
#############################################################
# Changes need to be made to all of the following #
#############################################################
#MY Domain details.
$TargetForest="yourdomainname.com"
$TargetOU = "OU=External Contacts,DC=yourdomainname,DC=com" # Where contacts will go
$TargetDC = "MyDc.yourdomainname.com" # Pref is for GC PDC
$TargetContactSuffix = " (The other domain)" # Appended to name i.e. "AUser Name (The other Domain name)"
# SOURCE - Where to read remote domains users from
$SourceForest="theotherdomain.com" # Domain name of Source of Contacts
$SourceDC = "DC1.theotherdomain.com" # Name of any DC in source Domain
$SourceOU = "OU=Myusers,DC=theotherdomain,DC=com" # Base OU/container to read users from
#############################################################
# end of config section #
#############################################################
#Connect to Source forest AD
Connect-QADService -Service $SourceForest
$SourceForestUsersToMigrate = Get-QADUser -SearchRoot $SourceOU -SearchScope Subtree -LdapFilter "(homeMDB=*)" -SizeLimit 0
#Connect to Destination Forest AD
Connect-QADService -Service $TargetForest
$UserCount =0
$NewUsers = @()
$MailErrors = @()
$SourceForestUsersToMigrate | ForEach-Object {
New-MailContact -DomainController $TargetDC -Name ($_.DisplayName + $TargetContactSuffix) -DisplayName ($_.DisplayName + $TargetContactSuffix) -FirstName $_.FirstName -LastName $_.LastName -Alias ($_.FirstName + ($_.LastName).ToUpper()) -OrganizationalUnit $TargetOU -ExternalEmailAddress $_.Email -ErrorAction SilentlyContinue
if ( $? -ne $true ) { #new-mailcontact failed if $False
# Why did the creation fail?
if ( $Error[0].exception.Gettype().fullname -eq "Microsoft.Exchange.Configuration.ObjectModel.ProxyAddressExistsException" ) {
"Email address already Exists: " + $_.email
$Contact = Get-Contact $_.UserPrincipalName
If ($? -ne $true ) {
$MailErrors += ("Could not do " + $_.userprincipalname + ":" + $_.email + "`n")
} else {
Set-Contact $Contact -Phone $_.PhoneNumber -Office $_.office -Title $_.title -Company $_.company -Department $_.department
}
}
}
else {
"Email Conatact added: " + ($_.DisplayName + $TargetContactSuffix) + " : " + $_.email
set-mailcontact -DomainController $TargetDC -Identity ($_.DisplayName + $TargetContactSuffix) -EmailAddressPolicyEnabled $false
Set-Mailcontact -DomainController $TargetDC -Identity ($_.DisplayName + $TargetContactSuffix) -EmailAddresses $_.Email
$NewUsers += ( $_.Email + " `n")
$UserCount = $UserCount + 1
}
}
$NewUsers
$MailErrors
J'exécute le script depuis un poste de la forêt source (Exchange 2007) avec les outils d'administration Exchange (2007) installés sur mon poste et avec un compte Administrateur de l'entreprise.
Je ne comprends pas quel est ce service "Accès au service liste d'adresse".
Si l'un de vous voit ce qui ne fonctionne pas je veux bien un coup de pouce.
Merci à vous
Orwell