No announcement yet.

Retrieve proxyaddresses for users

  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieve proxyaddresses for users

    I'm trying to retrieve X400 proxyaddresses for all users in an OU, but I am not quite able to succeed. I know proxyaddresses is a multivalued attribute, and therefore I will have to filter out only the X400 addresses somehow

    get-aduser -searchbase "ou=users,dc=contoso,dc=com" -searchscope 1 -filter * -properties proxyaddresses | select name, @{L='X400'; E={$_.proxyaddresses[1]}}

    Will give me the proxyaddress attribute stored at [1], but the problem is that for some users this might be X400, while for others it might be smtp. So how do I go about only retrieving the X400 value? I still want to enumerate all users in the OU, so for those who don't have an X400 valule, I want a blank line.

    Any ideas?

  • #2
    Re: Retrieve proxyaddresses for users

    This did the trick

    get-aduser -searchbase 'ou=users,dc=contoso,dc=com' -searchscope 1 -filter * -properties name, proxyaddresses | select name, @{l='X400';e={ $_.proxyAddresses | ?{ $_ -Like "*x400*" } }}