Get non-system account AD users that have a Job Title in PowerShell

Problem:

Generate a complete list of all AD users ignoring the system accounts

Solution:

For us the easiest way to do this was to filter on job title (as generally system accounts do not have one).

Get-ADUser -Filter * -Properties Title | Where Title | select Name, Title | Export-Csv c:\temp\users.csv -NoTypeInformation  

 

This command also filters on enabled accounts where the password never expires:

Get-ADUser -Filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties Surname,GivenName,mail,Title | Where Title | select Name,Surname,GivenName,mail | sort Name | Export-Csv c:\temp\users.csv -NoTypeInformation  

Leave a Reply

Your email address will not be published. Required fields are marked *