list AD users in powershell

This shows all the users with ‘dba’ in their username. Obviously you could leave out the filter clause altogether to get a complete list of AD users

Get-ADUser -Filter {samaccountname -like "*dba*"} -SearchBase "dc=mycomp,dc=co,dc=uk" |
    select samaccountname, name


samaccountname                                                      name   
--------------                                                      ----   
dba_john                                                            John Hollins
dba_terry                                                           Terry Dixon

You have to ActiveDirectory Powershell module loaded

Advertisements