Find AD users with specific AD attribute NOT null

Solution 1:

You should be able to get the users by using:

Get-ADUser -Filter 'teletexterminalidentifier -like "*"'

You can then filter what you need by piping the command:

Get-ADUser -Filter 'teletexterminalidentifier -like "*"' | Select-Object name,teletexterminalidentifier | Export-Csv file.csv

Where Select-Object lets you select what fields you want to get the info from by name.

Solution 2:

I think what you're looking for is the Where-Object cmdlet. Here's some pseudo code to help you:

Get-ADUser -Filter * | Where-Object {$_.teletexterminalidentifier -ne $null} | Export-Csv c:\list.csv