Author Posts

August 31, 2016 at 12:05 am

I have this one liner:

Get-ADUser -Filter * -Credential $creds | Where-Object {$_.altRecipient -ne $null}

...to find all users in our org that may have a value. It's not even returning my test User for which I did enter a DN value.

What is my error?

thanks

August 31, 2016 at 1:14 am

Get-aduser returns a subset of ad properties, to get other properties that aren't in that default set you can specify them with the -properties parameter.

Alternatively, it would also be more efficient to use the -filter parameter rather than where-object.

  • This reply was modified 1 year, 11 months ago by  Craig Duff.

August 31, 2016 at 1:22 am

Get-aduser -filter {altrecipient -like '*'}

That should work, I think.

  • This reply was modified 1 year, 11 months ago by  Craig Duff.

August 31, 2016 at 6:46 pm

Thanks Craig, that indeed did work for me. Appreciate the reply, but the odd thing is, even though it found my test User object that has a value for altRecipient, the select operation doesn't show the value. How can I reveal the actual value as well as find the User object that contains it?

Get-aduser -filter {altRecipient -like '*'} -Credential $creds | select altRecipient

altRecipient
------------
            
  • This reply was modified 1 year, 11 months ago by  Jeff Taylor.

August 31, 2016 at 7:02 pm

The filter doesn't require the property however you must include it for it to display.

Get-aduser -filter {altRecipient -like '*'} -Credential $creds -properties altrecipient

August 31, 2016 at 9:14 pm

Thanks Dan -properties altrecipient solved it.

Learning!