Report of all users for Proxyaddress attribute

Hi,

I need Proxyaddress attribute of all users in domain. Since there are multiple values available in this attribute i need either to get each attribute separately in column or search users with one particular value only. for an example i need all users who has proxyaddress contains "@domain.com"

Thanks in advance.

  • Hi  

    The below is an example, and should be tested in a dev environment. The LDAPFilter within the Get-QADObject below will find any object that has any entry in their ProxyAddresses field where it contains domain1.com (regardless of the type of Proxy Address)

    $OutPutFile = "$($env:USERPROFILE)\Desktop\ProxyAddresses.csv"
    
    $Objects = Get-QADObject -LdapFilter "(proxyAddresses=*domain.com*)" -DontUseDefaultIncludedProperties
    
    If($Objects)
    {
        "Object Name;Type;Address" | Out-File -FilePath $OutPutFile
        ForEach($Object in $Objects)
        {
            $ObjectName = $Object.samAccountName
            
            ForEach($ProxyAddresses in $Objects.ProxyAddresses)
            {
                $Address = $ProxyAddresses.split(":",[System.StringSplitOptions]::RemoveEmptyEntries)
    
                "$ObjectName;$($Address[0]);$($Address[1])"  | Out-File -FilePath $OutPutFile -Append
                Write-host "$ObjectName - $($Address[0]) - $($Address[1])"
            }      
        }
    }

    IE, if you have User1 with the following ProxyAddress, it would be picked up by the LDAPFilter

    SMTP:User1@Test.lab

    smtp:User1@Ext.Acme.com

    SIP:User1@test.lab

    sip:User1@Domain.com

    Therefore you either need to make you're LDAP filter slightly more complete, or add a check within the loop outputting the current objects row to file, to prevent it for exporting records you don't want to see.

    Hope this helps

    Stu