none
Find mail and proxyaddresses using Get-AdObject RRS feed

  • Question

  • I have been task with finding contacts from a specific fqdn in our organization.  Once the contacts have been found, I will then need to check for duplicates against the "mail" and "proxyaddresses" attributes.  Right now I am just trying to pull all of the contacts to drop in variable.  But I keep getting this message below.

    Here is the script and error message below.

    _____________________________________________________________________________________________________________________________________________________________________________________________
     C:\Users\admin2>Get-ADObject -Filter {(mail -like "*@usbrazil.com") -and (ObjectClass -eq "contact") -and (proxyAddresses -like "*@usbrazil.com")} -SearchBase 'OU=USBrazil,OU=Users,OU=World Organization,DC=nation,DC=world,DC=local'

    Get-ADObject : The supplied distinguishedName must belong to one of the following partition(s): 'CN=Configuration,DC=world,DC=local, CN=Schema,CN=Configuration,DC=world,DC=local, DC=servers,DC
    =world,DC=local , DC=DomainDnsZones,DC=servers,DC=world,DC=local , DC=ForestDnsZones,DC=world,DC=local'.
    At line:1 char:13
    + Get-ADObject <<<<  -SearchBase 'OU=USBrazil,OU=Users,OU=World Organization,DC=nation,DC=world,DC=local' -Filter {(mail -like "*@usbrazil.com") -and (ObjectClass -eq "contact") -and (proxyAddresses -
    like "*@usbrazil.com")}
        + CategoryInfo          : InvalidArgument: (:) [Get-ADObject], ArgumentException
        + FullyQualifiedErrorId : The supplied distinguishedName must belong to one of the following partition(s): 'CN=Configuration,DC=world,DC=local , CN=Schema,CN=Configuration,DC=world,DC=local
        , DC=servers,DC=world,DC=local , DC=DomainDnsZones,DC=servers,DC=world,DC=local , DC=ForestDnsZones,DC=world,DC=local'.,Microsoft.ActiveDirectory.Management.Commands.GetADObject





    Friday, December 8, 2017 3:04 PM

Answers

  • The error message seems to indicate you are not in the dc=Nation domain. Use the -Server option of Get-ADObject to either target a GC in your domain, or target a DC in the dc=Nation domain. Also, if you intend to later do something with the mail and proxyAddresses attributes, specify them with the -Properties parameter.

    Edit: To specify a GC, specify the DC and the GC port. For example:

    -Server "corp-DC12.corp.contoso.com:3268"
    Edit: Sorry, I should have checked. The mail attribute is replicated to the GC, but the proxyAddresses attribute is not (by default). You will need to target a DC in the other domain.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)



    Friday, December 8, 2017 3:15 PM
    Moderator

All replies

  • The error message seems to indicate you are not in the dc=Nation domain. Use the -Server option of Get-ADObject to either target a GC in your domain, or target a DC in the dc=Nation domain. Also, if you intend to later do something with the mail and proxyAddresses attributes, specify them with the -Properties parameter.

    Edit: To specify a GC, specify the DC and the GC port. For example:

    -Server "corp-DC12.corp.contoso.com:3268"
    Edit: Sorry, I should have checked. The mail attribute is replicated to the GC, but the proxyAddresses attribute is not (by default). You will need to target a DC in the other domain.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)



    Friday, December 8, 2017 3:15 PM
    Moderator
  • Now I just need to figure out how to get the code to due the comparison to point out the duplicate and only deliver the contact that are duplicates.
    Monday, December 11, 2017 3:02 PM